Merge pull request #553 from vdemeester/move-version-in-package

Move version.go in its own package…
This commit is contained in:
Emile Vauge 2016-07-21 17:35:52 +02:00 committed by GitHub
commit 58b6d92ce2
6 changed files with 18 additions and 31 deletions

View file

@ -6,7 +6,4 @@ Copyright
//go:generate mkdir -p static
//go:generate go-bindata -pkg autogen -o autogen/gen.go ./static/... ./templates/...
//go:generate mkdir -p vendor/github.com/docker/docker/autogen/dockerversion
//go:generate cp script/dockerversion vendor/github.com/docker/docker/autogen/dockerversion/dockerversion.go
package main

View file

@ -15,6 +15,7 @@ import (
"github.com/cenkalti/backoff"
"github.com/containous/traefik/safe"
"github.com/containous/traefik/types"
"github.com/containous/traefik/version"
"github.com/docker/engine-api/client"
dockertypes "github.com/docker/engine-api/types"
eventtypes "github.com/docker/engine-api/types/events"
@ -38,8 +39,7 @@ type Docker struct {
func (provider *Docker) createClient() (client.APIClient, error) {
var httpClient *http.Client
httpHeaders := map[string]string{
// FIXME(vdemeester) use version here O:)
"User-Agent": "Traefik",
"User-Agent": "Traefik " + version.Version,
}
if provider.TLS != nil {
config, err := provider.TLS.CreateTLSConfig()

View file

@ -26,4 +26,4 @@ if [ -z "$DATE" ]; then
fi
# Build binaries
CGO_ENABLED=0 GOGC=off go build $FLAGS -ldflags "-s -w -X main.Version=$VERSION -X main.Codename=$CODENAME -X main.BuildDate=$DATE" -a -installsuffix nocgo -o dist/traefik .
CGO_ENABLED=0 GOGC=off go build $FLAGS -ldflags "-s -w -X version.Version=$VERSION -X version.Codename=$CODENAME -X version.BuildDate=$DATE" -a -installsuffix nocgo -o dist/traefik .

View file

@ -1,12 +0,0 @@
// AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
package dockerversion
var (
GITCOMMIT string = "traefik-import"
VERSION string = "traefik-import"
BUILDTIME string = "traefik-import"
IAMSTATIC string = "traefik-import"
INITSHA1 string = "traefik-import"
INITPATH string = "traefik-import"
)

View file

@ -3,14 +3,6 @@ package main
import (
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/containous/flaeg"
"github.com/containous/staert"
"github.com/containous/traefik/acme"
"github.com/containous/traefik/middlewares"
"github.com/containous/traefik/provider"
"github.com/containous/traefik/types"
"github.com/docker/libkv/store"
fmtlog "log"
"net/http"
"os"
@ -18,6 +10,16 @@ import (
"runtime"
"strings"
"text/template"
log "github.com/Sirupsen/logrus"
"github.com/containous/flaeg"
"github.com/containous/staert"
"github.com/containous/traefik/acme"
"github.com/containous/traefik/middlewares"
"github.com/containous/traefik/provider"
"github.com/containous/traefik/types"
"github.com/containous/traefik/version"
"github.com/docker/libkv/store"
)
var versionTemplate = `Version: {{.Version}}
@ -65,10 +67,10 @@ Complete documentation is available at https://traefik.io`,
Os string
Arch string
}{
Version: Version,
Codename: Codename,
Version: version.Version,
Codename: version.Codename,
GoVersion: runtime.Version(),
BuildTime: BuildDate,
BuildTime: version.BuildDate,
Os: runtime.GOOS,
Arch: runtime.GOARCH,
}
@ -184,7 +186,7 @@ func run(traefikConfiguration *TraefikConfiguration) {
log.SetFormatter(&log.TextFormatter{FullTimestamp: true, DisableSorting: true})
}
jsonConf, _ := json.Marshal(globalConfiguration)
log.Infof("Traefik version %s built on %s", Version, BuildDate)
log.Infof("Traefik version %s built on %s", version.Version, version.BuildDate)
if len(traefikConfiguration.ConfigFile) != 0 {
log.Infof("Using TOML configuration file %s", traefikConfiguration.ConfigFile)
}

View file

@ -1,4 +1,4 @@
package main
package version
var (
// Version holds the current version of traefik.