diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fa4c80a08..11fa07646 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,7 +12,7 @@ You need to run the `binary` target. This will create binaries for Linux platfor $ make binary docker build -t "traefik-dev:no-more-godep-ever" -f build.Dockerfile . Sending build context to Docker daemon 295.3 MB -Step 0 : FROM golang:1.5 +Step 0 : FROM golang:1.7 ---> 8c6473912976 Step 1 : RUN go get github.com/Masterminds/glide [...] @@ -30,8 +30,7 @@ traefik* ###### Setting up your `go` environment -- You need `go` v1.5+ (1.7 is acceptable) -- You need to set `$ export GO15VENDOREXPERIMENT=1` environment variable if you are using go v1.5 (it is already enabled in 1.6+) +- You need `go` v1.7+ - It is recommended you clone Træfɪk into a directory like `~/go/src/github.com/containous/traefik` (This is the official golang workspace hierarchy, and will allow dependencies to resolve properly) - This will allow your `GOPATH` and `PATH` variable to be set to `~/go` via: ``` diff --git a/acme/acme.go b/acme/acme.go index 6bb9d5341..bbe561e47 100644 --- a/acme/acme.go +++ b/acme/acme.go @@ -1,6 +1,7 @@ package acme import ( + "context" "crypto/tls" "errors" "fmt" @@ -12,7 +13,6 @@ import ( "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/xenolf/lego/acme" - "golang.org/x/net/context" "io/ioutil" fmtlog "log" "os" diff --git a/cluster/datastore.go b/cluster/datastore.go index ce36e8fe4..a357fa1dc 100644 --- a/cluster/datastore.go +++ b/cluster/datastore.go @@ -1,6 +1,7 @@ package cluster import ( + "context" "encoding/json" "fmt" "github.com/cenk/backoff" @@ -9,7 +10,6 @@ import ( "github.com/containous/traefik/log" "github.com/docker/libkv/store" "github.com/satori/go.uuid" - "golang.org/x/net/context" "sync" "time" ) diff --git a/cluster/leadership.go b/cluster/leadership.go index 80447fa90..ca3fd1f9d 100644 --- a/cluster/leadership.go +++ b/cluster/leadership.go @@ -1,12 +1,12 @@ package cluster import ( + "context" "github.com/cenk/backoff" "github.com/containous/traefik/log" "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/docker/leadership" - "golang.org/x/net/context" "time" ) diff --git a/glide.lock b/glide.lock index 96ae7f6b0..e860a9b02 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 39ff28cc1d13d5915a870b14491ece1849c4eaf5a56cecd50a7676ecee6c6143 -updated: 2016-10-06T14:06:39.455848971+02:00 +hash: 5a4ccfe1c0ee6b0c67a40ceb07a8510d61646e1551599331b626ccf1341f4048 +updated: 2016-11-15T19:22:10.412299841Z imports: - name: github.com/abbot/go-http-auth version: cb4372376e1e00e9f6ab9ec142e029302c9e7140 @@ -14,9 +14,9 @@ imports: - name: github.com/cenk/backoff version: 8edc80b07f38c27352fb186d971c628a6c32552b - name: github.com/codahale/hdrhistogram - version: f8ad88b59a584afeee9d334eff879b104439117b + version: 9208b142303c12d8899bae836fd524ac9338b4fd - name: github.com/codegangsta/cli - version: 1efa31f08b9333f1bd4882d61f9d668a70cd902e + version: bf4a526f48af7badd25d2cb02d587e1b01be3b50 - name: github.com/codegangsta/negroni version: 3f7ce7b928e14ff890b067e5bbbc80af73690a9c - name: github.com/containous/flaeg @@ -26,15 +26,13 @@ imports: - name: github.com/containous/staert version: 92329254783dc01174f03302d51d7cf2c9ff84cf - name: github.com/coreos/etcd - version: 1c9e0a0e33051fed6c05c141e6fcbfe5c7f2a899 + version: c400d05d0aa73e21e431c16145e558d624098018 subpackages: + - Godeps/_workspace/src/github.com/ugorji/go/codec + - Godeps/_workspace/src/golang.org/x/net/context - client - pkg/pathutil - pkg/types -- name: github.com/davecgh/go-spew - version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 - subpackages: - - spew - name: github.com/docker/distribution version: 99cb7c0946d2f5a38015443e515dc916295064d7 subpackages: @@ -157,9 +155,9 @@ imports: - name: github.com/gambol99/go-marathon version: a558128c87724cd7430060ef5aedf39f83937f55 - name: github.com/go-check/check - version: 4f90aeace3a26ad7021961c297b22c42160c7b25 + version: 11d3bc7aa68e238947792f30573146a3231fc0f1 - name: github.com/gogo/protobuf - version: 99cb9b23110011cc45571c901ecae6f6f5e65cd3 + version: 43ab7f0ec7b6d072e0368bd537ffefe74ed30198 subpackages: - proto - name: github.com/golang/glog @@ -169,7 +167,7 @@ imports: subpackages: - query - name: github.com/gorilla/context - version: 08b5f424b9271eedf6f9f0ce86cb9396ed337a42 + version: 14f550f51af52180c2eefed15e5fd18d63c0a64a - name: github.com/hashicorp/consul version: d8e2fb7dd594163e25a89bc52c1a4613f5c5bfb8 subpackages: @@ -177,7 +175,7 @@ imports: - name: github.com/hashicorp/go-cleanhttp version: ad28ea4487f05916463e2423a55166280e8254b5 - name: github.com/hashicorp/serf - version: b03bf85930b2349eb04b97c8fac437495296e3e7 + version: 598c54895cc5a7b1a24a398d635e8c0ea0959870 subpackages: - coordinate - name: github.com/jarcoal/httpmock @@ -229,15 +227,11 @@ imports: - name: github.com/ogier/pflag version: 45c278ab3607870051a2ea9040bb85fcb8557481 - name: github.com/opencontainers/runc - version: 02f8fa7863dd3f82909a73e2061897828460d52f + version: ba1568de399395774ad84c2ace65937814c542ed subpackages: - libcontainer/user - name: github.com/parnurzeal/gorequest version: e30af16d4e485943aab0b0885ad6bdbb8c0d3dc7 -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib - name: github.com/ryanuber/go-glob version: 572520ed46dbddaed19ea3d9541bdd0494163693 - name: github.com/samuel/go-zookeeper @@ -253,7 +247,7 @@ imports: - name: github.com/stretchr/objx version: cbeaeb16a013161a98496fad62933b1d21786672 - name: github.com/stretchr/testify - version: 976c720a22c8eb4eb6a0b4348ad85ad12491a506 + version: b8dc1cecf15bdaf1988d9e87aa7cd98d899a06d6 subpackages: - assert - mock @@ -261,10 +255,6 @@ imports: version: 152b5d051953fdb6e45f14b6826962aadc032324 - name: github.com/tv42/zbase32 version: 03389da7e0bf9844767f82690f4d68fc097a1306 -- name: github.com/ugorji/go - version: b94837a2404ab90efe9289e77a70694c355739cb - subpackages: - - codec - name: github.com/unrolled/render version: 526faf80cd4b305bb8134abea8d20d5ced74faa6 - name: github.com/vdemeester/docker-events @@ -288,7 +278,7 @@ imports: - name: github.com/vulcand/route version: cb89d787ddbb1c5849a7ac9f79004c1fd12a4a32 - name: github.com/vulcand/vulcand - version: bed092e10989250b48bdb6aa3b0557b207f05c80 + version: 42492a3a85e294bdbdd1bcabb8c12769a81ea284 subpackages: - conntracker - plugin @@ -299,26 +289,26 @@ imports: subpackages: - acme - name: golang.org/x/crypto - version: d81fdb778bf2c40a91b24519d60cdc5767318829 + version: 4ed45ec682102c643324fae5dff8dab085b6c300 subpackages: - bcrypt - blowfish - ocsp - name: golang.org/x/net - version: b400c2eff1badec7022a8c8f5bea058b6315eed7 + version: 6460565bec1e8891e29ff478184c71b9e443ac36 subpackages: - context - proxy - publicsuffix - name: golang.org/x/sys - version: 62bee037599929a6e9146f29d10dd5208c43507d + version: eb2c74142fd19a79b3f237334c7384d5167b1b46 subpackages: - unix - windows - name: gopkg.in/fsnotify.v1 version: 944cff21b3baf3ced9a880365682152ba577d348 - name: gopkg.in/mgo.v2 - version: 22287bab4379e1fbf6002fb4eb769888f3fb224c + version: 29cc868a5ca65f401ff318143f9408d02f4799cc subpackages: - bson - name: gopkg.in/square/go-jose.v1 @@ -336,11 +326,11 @@ testImports: - name: github.com/flynn/go-shlex version: 3f9db97f856818214da2e1057f8ad84803971cff - name: github.com/gorilla/mux - version: 9fa818a44c2bf1396a17f9d5a3c0f6dd39d2ff8e + version: e444e69cbd2e2e3e0749a2f3c717cec491552bbf - name: github.com/libkermit/docker-check version: cbe0ef03b3d23070eac4d00ba8828f2cc7f7e5a3 - name: github.com/spf13/pflag - version: 08b1a584251b5b62f458943640fc8ebd4d50aaa5 + version: 5644820622454e71517561946e3d94b9f9db6842 - name: github.com/vbatts/tar-split version: bd4c5d64c3e9297f410025a3b1bd0c58f659e721 subpackages: diff --git a/glide.yaml b/glide.yaml index 6230825c3..718012c2b 100644 --- a/glide.yaml +++ b/glide.yaml @@ -64,9 +64,6 @@ import: version: b2fad6198110326662e9e356a97199078a4a775c subpackages: - acme -- package: golang.org/x/net - subpackages: - - context - package: gopkg.in/fsnotify.v1 - package: github.com/libkermit/compose version: cadc5a3b83a15790174bd7fbc75ea2529785e772 diff --git a/integration/consul_test.go b/integration/consul_test.go index e80e4747d..4c315150d 100644 --- a/integration/consul_test.go +++ b/integration/consul_test.go @@ -5,12 +5,12 @@ import ( "os/exec" "time" + "context" "github.com/containous/staert" "github.com/docker/libkv" "github.com/docker/libkv/store" "github.com/docker/libkv/store/consul" "github.com/go-check/check" - "golang.org/x/net/context" "errors" "github.com/containous/traefik/cluster" diff --git a/provider/docker.go b/provider/docker.go index cd5ddc847..bbcd3d931 100644 --- a/provider/docker.go +++ b/provider/docker.go @@ -1,6 +1,7 @@ package provider import ( + "context" "errors" "math" "net" @@ -10,8 +11,6 @@ import ( "text/template" "time" - "golang.org/x/net/context" - "github.com/BurntSushi/ty/fun" "github.com/cenk/backoff" "github.com/containous/traefik/job" diff --git a/safe/routine.go b/safe/routine.go index a7f171968..70937fbb6 100644 --- a/safe/routine.go +++ b/safe/routine.go @@ -1,8 +1,8 @@ package safe import ( + "context" "github.com/containous/traefik/log" - "golang.org/x/net/context" "runtime/debug" "sync" ) @@ -21,18 +21,20 @@ type Pool struct { waitGroup sync.WaitGroup lock sync.Mutex baseCtx context.Context + baseCancel context.CancelFunc ctx context.Context cancel context.CancelFunc } // NewPool creates a Pool func NewPool(parentCtx context.Context) *Pool { - baseCtx, _ := context.WithCancel(parentCtx) + baseCtx, baseCancel := context.WithCancel(parentCtx) ctx, cancel := context.WithCancel(baseCtx) return &Pool{ - baseCtx: baseCtx, - ctx: ctx, - cancel: cancel, + baseCtx: baseCtx, + baseCancel: baseCancel, + ctx: ctx, + cancel: cancel, } } @@ -90,6 +92,14 @@ func (p *Pool) Stop() { } } +// Cleanup releases resources used by the pool, and should be called when the pool will no longer be used +func (p *Pool) Cleanup() { + p.Stop() + p.lock.Lock() + defer p.lock.Unlock() + p.baseCancel() +} + // Start starts all stopped routines func (p *Pool) Start() { p.lock.Lock() diff --git a/server.go b/server.go index e6a3bc555..83f97864b 100644 --- a/server.go +++ b/server.go @@ -4,6 +4,7 @@ Copyright package main import ( + "context" "crypto/tls" "crypto/x509" "encoding/json" @@ -19,8 +20,6 @@ import ( "syscall" "time" - "golang.org/x/net/context" - "github.com/codegangsta/negroni" "github.com/containous/mux" "github.com/containous/traefik/cluster" @@ -134,7 +133,7 @@ func (server *Server) Close() { } }(ctx) server.stopLeadership() - server.routinesPool.Stop() + server.routinesPool.Cleanup() close(server.configurationChan) close(server.configurationValidatedChan) signal.Stop(server.signals)