From 8a348423ae542c995b7de602b5ea20e3c45a1364 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Fri, 30 Dec 2016 09:21:13 +0100 Subject: [PATCH] Import order as goimports does Signed-off-by: Vincent Demeester --- acme/account.go | 5 +++-- acme/acme.go | 11 ++++++----- acme/acme_test.go | 3 ++- acme/challengeProvider.go | 4 ++-- acme/localStore.go | 5 +++-- cluster/datastore.go | 5 +++-- cluster/leadership.go | 3 ++- cmd/bug.go | 5 +++-- cmd/version.go | 5 +++-- job/job.go | 3 ++- job/job_test.go | 3 ++- log/logger.go | 3 ++- middlewares/authenticator.go | 5 +++-- middlewares/authenticator_test.go | 7 ++++--- middlewares/compress.go | 3 ++- middlewares/handlerSwitcher.go | 3 ++- middlewares/logger_test.go | 5 +++-- middlewares/retry.go | 5 +++-- middlewares/rewrite.go | 3 ++- provider/boltdb.go | 1 + provider/consul.go | 1 + provider/docker_test.go | 3 +-- provider/etcd.go | 1 + provider/eureka.go | 11 ++++++----- provider/eureka_test.go | 3 ++- provider/kubernetes.go | 10 ++++------ provider/kubernetes_test.go | 5 ++--- provider/kv.go | 2 +- provider/kv_test.go | 6 +++--- provider/marathon.go | 5 ++--- provider/marathon_test.go | 3 +-- provider/mesos.go | 6 +++--- provider/provider.go | 9 ++++----- provider/zk.go | 1 + safe/routine.go | 3 ++- types/types.go | 3 ++- version/version.go | 3 ++- 37 files changed, 91 insertions(+), 71 deletions(-) diff --git a/acme/account.go b/acme/account.go index 52897db02..d459142d5 100644 --- a/acme/account.go +++ b/acme/account.go @@ -7,11 +7,12 @@ import ( "crypto/tls" "crypto/x509" "errors" - "github.com/containous/traefik/log" - "github.com/xenolf/lego/acme" "reflect" "sync" "time" + + "github.com/containous/traefik/log" + "github.com/xenolf/lego/acme" ) // Account is used to store lets encrypt registration info diff --git a/acme/acme.go b/acme/acme.go index ba4250d03..2beb866a9 100644 --- a/acme/acme.go +++ b/acme/acme.go @@ -5,6 +5,12 @@ import ( "crypto/tls" "errors" "fmt" + "io/ioutil" + fmtlog "log" + "os" + "strings" + "time" + "github.com/BurntSushi/ty/fun" "github.com/cenk/backoff" "github.com/containous/staert" @@ -14,11 +20,6 @@ import ( "github.com/containous/traefik/types" "github.com/xenolf/lego/acme" "github.com/xenolf/lego/providers/dns" - "io/ioutil" - fmtlog "log" - "os" - "strings" - "time" ) var ( diff --git a/acme/acme_test.go b/acme/acme_test.go index dd11e22d4..5e5e638f8 100644 --- a/acme/acme_test.go +++ b/acme/acme_test.go @@ -2,12 +2,13 @@ package acme import ( "encoding/base64" - "github.com/xenolf/lego/acme" "net/http" "net/http/httptest" "reflect" "sync" "testing" + + "github.com/xenolf/lego/acme" ) func TestDomainsSet(t *testing.T) { diff --git a/acme/challengeProvider.go b/acme/challengeProvider.go index 2d5a8daae..464179760 100644 --- a/acme/challengeProvider.go +++ b/acme/challengeProvider.go @@ -2,15 +2,15 @@ package acme import ( "crypto/tls" + "fmt" "strings" "sync" + "time" - "fmt" "github.com/cenk/backoff" "github.com/containous/traefik/cluster" "github.com/containous/traefik/log" "github.com/xenolf/lego/acme" - "time" ) var _ acme.ChallengeProviderTimeout = (*challengeProvider)(nil) diff --git a/acme/localStore.go b/acme/localStore.go index f01e31d68..536fad509 100644 --- a/acme/localStore.go +++ b/acme/localStore.go @@ -3,10 +3,11 @@ package acme import ( "encoding/json" "fmt" - "github.com/containous/traefik/cluster" - "github.com/containous/traefik/log" "io/ioutil" "sync" + + "github.com/containous/traefik/cluster" + "github.com/containous/traefik/log" ) var _ cluster.Store = (*LocalStore)(nil) diff --git a/cluster/datastore.go b/cluster/datastore.go index a357fa1dc..3ddfd144d 100644 --- a/cluster/datastore.go +++ b/cluster/datastore.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" "fmt" + "sync" + "time" + "github.com/cenk/backoff" "github.com/containous/staert" "github.com/containous/traefik/job" "github.com/containous/traefik/log" "github.com/docker/libkv/store" "github.com/satori/go.uuid" - "sync" - "time" ) // Metadata stores Object plus metadata diff --git a/cluster/leadership.go b/cluster/leadership.go index ca3fd1f9d..8b6a66802 100644 --- a/cluster/leadership.go +++ b/cluster/leadership.go @@ -2,12 +2,13 @@ package cluster import ( "context" + "time" + "github.com/cenk/backoff" "github.com/containous/traefik/log" "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/docker/leadership" - "time" ) // Leadership allows leadership election using a KV store diff --git a/cmd/bug.go b/cmd/bug.go index 917135a67..292db1e26 100644 --- a/cmd/bug.go +++ b/cmd/bug.go @@ -4,13 +4,14 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/containous/flaeg" - "github.com/mvdan/xurls" "net/url" "os/exec" "regexp" "runtime" "text/template" + + "github.com/containous/flaeg" + "github.com/mvdan/xurls" ) var ( diff --git a/cmd/version.go b/cmd/version.go index d38ec0cc8..09406d1c4 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -2,12 +2,13 @@ package cmd import ( "fmt" - "github.com/containous/flaeg" - "github.com/containous/traefik/version" "io" "os" "runtime" "text/template" + + "github.com/containous/flaeg" + "github.com/containous/traefik/version" ) var versionTemplate = `Version: {{.Version}} diff --git a/job/job.go b/job/job.go index afb991425..75ba1a796 100644 --- a/job/job.go +++ b/job/job.go @@ -1,8 +1,9 @@ package job import ( - "github.com/cenk/backoff" "time" + + "github.com/cenk/backoff" ) var ( diff --git a/job/job_test.go b/job/job_test.go index e731ffda3..b51e67f9c 100644 --- a/job/job_test.go +++ b/job/job_test.go @@ -1,9 +1,10 @@ package job import ( - "github.com/cenk/backoff" "testing" "time" + + "github.com/cenk/backoff" ) func TestJobBackOff(t *testing.T) { diff --git a/log/logger.go b/log/logger.go index 9ef60fc27..e283874db 100644 --- a/log/logger.go +++ b/log/logger.go @@ -1,8 +1,9 @@ package log import ( - "github.com/Sirupsen/logrus" "io" + + "github.com/Sirupsen/logrus" ) var ( diff --git a/middlewares/authenticator.go b/middlewares/authenticator.go index f4361767b..2d4fb809b 100644 --- a/middlewares/authenticator.go +++ b/middlewares/authenticator.go @@ -2,12 +2,13 @@ package middlewares import ( "fmt" + "net/http" + "strings" + "github.com/abbot/go-http-auth" "github.com/codegangsta/negroni" "github.com/containous/traefik/log" "github.com/containous/traefik/types" - "net/http" - "strings" ) // Authenticator is a middleware that provides HTTP basic and digest authentication diff --git a/middlewares/authenticator_test.go b/middlewares/authenticator_test.go index c4c5ec645..f990f8681 100644 --- a/middlewares/authenticator_test.go +++ b/middlewares/authenticator_test.go @@ -2,13 +2,14 @@ package middlewares import ( "fmt" - "github.com/codegangsta/negroni" - "github.com/containous/traefik/types" - "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "net/http/httptest" "testing" + + "github.com/codegangsta/negroni" + "github.com/containous/traefik/types" + "github.com/stretchr/testify/assert" ) func TestBasicAuthFail(t *testing.T) { diff --git a/middlewares/compress.go b/middlewares/compress.go index 26709ad7b..d4a07e37c 100644 --- a/middlewares/compress.go +++ b/middlewares/compress.go @@ -1,8 +1,9 @@ package middlewares import ( - "github.com/NYTimes/gziphandler" "net/http" + + "github.com/NYTimes/gziphandler" ) // Compress is a middleware that allows redirections diff --git a/middlewares/handlerSwitcher.go b/middlewares/handlerSwitcher.go index b9a0903e2..a7a1a9b63 100644 --- a/middlewares/handlerSwitcher.go +++ b/middlewares/handlerSwitcher.go @@ -1,9 +1,10 @@ package middlewares import ( + "net/http" + "github.com/containous/mux" "github.com/containous/traefik/safe" - "net/http" ) // HandlerSwitcher allows hot switching of http.ServeMux diff --git a/middlewares/logger_test.go b/middlewares/logger_test.go index 72ea4704e..1632f0e49 100644 --- a/middlewares/logger_test.go +++ b/middlewares/logger_test.go @@ -2,8 +2,6 @@ package middlewares import ( "fmt" - shellwords "github.com/mattn/go-shellwords" - "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "net/url" @@ -11,6 +9,9 @@ import ( "path/filepath" "runtime" "testing" + + shellwords "github.com/mattn/go-shellwords" + "github.com/stretchr/testify/assert" ) type logtestResponseWriter struct{} diff --git a/middlewares/retry.go b/middlewares/retry.go index 021306304..e290963b4 100644 --- a/middlewares/retry.go +++ b/middlewares/retry.go @@ -3,10 +3,11 @@ package middlewares import ( "bufio" "bytes" - "github.com/containous/traefik/log" - "github.com/vulcand/oxy/utils" "net" "net/http" + + "github.com/containous/traefik/log" + "github.com/vulcand/oxy/utils" ) var ( diff --git a/middlewares/rewrite.go b/middlewares/rewrite.go index d3bc4d635..e130b5534 100644 --- a/middlewares/rewrite.go +++ b/middlewares/rewrite.go @@ -1,9 +1,10 @@ package middlewares import ( + "net/http" + "github.com/containous/traefik/log" "github.com/vulcand/vulcand/plugin/rewrite" - "net/http" ) // Rewrite is a middleware that allows redirections diff --git a/provider/boltdb.go b/provider/boltdb.go index e604fd428..588c128f2 100644 --- a/provider/boltdb.go +++ b/provider/boltdb.go @@ -2,6 +2,7 @@ package provider import ( "fmt" + "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/docker/libkv/store" diff --git a/provider/consul.go b/provider/consul.go index 9316c513a..994b87e84 100644 --- a/provider/consul.go +++ b/provider/consul.go @@ -2,6 +2,7 @@ package provider import ( "fmt" + "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/docker/libkv/store" diff --git a/provider/docker_test.go b/provider/docker_test.go index 43fbcb5e4..4c10be819 100644 --- a/provider/docker_test.go +++ b/provider/docker_test.go @@ -9,9 +9,8 @@ import ( docker "github.com/docker/engine-api/types" "github.com/docker/engine-api/types/container" "github.com/docker/engine-api/types/network" + "github.com/docker/engine-api/types/swarm" "github.com/docker/go-connections/nat" - - swarm "github.com/docker/engine-api/types/swarm" ) func TestDockerGetFrontendName(t *testing.T) { diff --git a/provider/etcd.go b/provider/etcd.go index 7dc49d0aa..a4699029e 100644 --- a/provider/etcd.go +++ b/provider/etcd.go @@ -2,6 +2,7 @@ package provider import ( "fmt" + "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/docker/libkv/store" diff --git a/provider/eureka.go b/provider/eureka.go index 4b6ff8932..29329a31d 100644 --- a/provider/eureka.go +++ b/provider/eureka.go @@ -1,17 +1,18 @@ package provider import ( + "io/ioutil" + "strconv" + "strings" + "text/template" + "time" + "github.com/ArthurHlt/go-eureka-client/eureka" log "github.com/Sirupsen/logrus" "github.com/cenk/backoff" "github.com/containous/traefik/job" "github.com/containous/traefik/safe" "github.com/containous/traefik/types" - "io/ioutil" - "strconv" - "strings" - "text/template" - "time" ) // Eureka holds configuration of the Eureka provider. diff --git a/provider/eureka_test.go b/provider/eureka_test.go index 407c997af..8a2ab8a8b 100644 --- a/provider/eureka_test.go +++ b/provider/eureka_test.go @@ -1,8 +1,9 @@ package provider import ( - "github.com/ArthurHlt/go-eureka-client/eureka" "testing" + + "github.com/ArthurHlt/go-eureka-client/eureka" ) func TestEurekaGetPort(t *testing.T) { diff --git a/provider/kubernetes.go b/provider/kubernetes.go index 1752cf686..42a01d2f6 100644 --- a/provider/kubernetes.go +++ b/provider/kubernetes.go @@ -7,16 +7,14 @@ import ( "text/template" "time" - "k8s.io/client-go/1.5/pkg/api/v1" - "k8s.io/client-go/1.5/pkg/util/intstr" - + "github.com/cenk/backoff" + "github.com/containous/traefik/job" "github.com/containous/traefik/log" "github.com/containous/traefik/provider/k8s" "github.com/containous/traefik/safe" "github.com/containous/traefik/types" - - "github.com/cenk/backoff" - "github.com/containous/traefik/job" + "k8s.io/client-go/1.5/pkg/api/v1" + "k8s.io/client-go/1.5/pkg/util/intstr" ) var _ Provider = (*Kubernetes)(nil) diff --git a/provider/kubernetes_test.go b/provider/kubernetes_test.go index 7b87da941..6b0424d05 100644 --- a/provider/kubernetes_test.go +++ b/provider/kubernetes_test.go @@ -5,12 +5,11 @@ import ( "reflect" "testing" + "github.com/containous/traefik/provider/k8s" + "github.com/containous/traefik/types" "k8s.io/client-go/1.5/pkg/api/v1" "k8s.io/client-go/1.5/pkg/apis/extensions/v1beta1" "k8s.io/client-go/1.5/pkg/util/intstr" - - "github.com/containous/traefik/provider/k8s" - "github.com/containous/traefik/types" ) func TestLoadIngresses(t *testing.T) { diff --git a/provider/kv.go b/provider/kv.go index 0e29ec2be..566188b45 100644 --- a/provider/kv.go +++ b/provider/kv.go @@ -2,12 +2,12 @@ package provider import ( + "errors" "fmt" "strings" "text/template" "time" - "errors" "github.com/BurntSushi/ty/fun" "github.com/cenk/backoff" "github.com/containous/traefik/job" diff --git a/provider/kv_test.go b/provider/kv_test.go index e0913b110..bba8fab47 100644 --- a/provider/kv_test.go +++ b/provider/kv_test.go @@ -2,14 +2,14 @@ package provider import ( "errors" - "github.com/containous/traefik/types" + "reflect" + "sort" "strings" "testing" "time" + "github.com/containous/traefik/types" "github.com/docker/libkv/store" - "reflect" - "sort" ) func TestKvList(t *testing.T) { diff --git a/provider/marathon.go b/provider/marathon.go index 5e901f37c..17954f83f 100644 --- a/provider/marathon.go +++ b/provider/marathon.go @@ -2,14 +2,13 @@ package provider import ( "errors" + "math" "net" + "net/http" "net/url" "strconv" "strings" "text/template" - - "math" - "net/http" "time" "github.com/BurntSushi/ty/fun" diff --git a/provider/marathon_test.go b/provider/marathon_test.go index 1fa1dbe9a..bb884db52 100644 --- a/provider/marathon_test.go +++ b/provider/marathon_test.go @@ -1,11 +1,10 @@ package provider import ( + "errors" "reflect" "testing" - "errors" - "github.com/containous/traefik/mocks" "github.com/containous/traefik/types" "github.com/gambol99/go-marathon" diff --git a/provider/mesos.go b/provider/mesos.go index b6db4f597..6935712d8 100644 --- a/provider/mesos.go +++ b/provider/mesos.go @@ -2,11 +2,10 @@ package provider import ( "errors" + "fmt" "strconv" "strings" "text/template" - - "fmt" "time" "github.com/BurntSushi/ty/fun" @@ -16,7 +15,8 @@ import ( "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/mesos/mesos-go/detector" - _ "github.com/mesos/mesos-go/detector/zoo" // Registers the ZK detector + // Register mesos zoo the detector + _ "github.com/mesos/mesos-go/detector/zoo" "github.com/mesosphere/mesos-dns/detect" "github.com/mesosphere/mesos-dns/logging" "github.com/mesosphere/mesos-dns/records" diff --git a/provider/provider.go b/provider/provider.go index 641c70fc8..2782d3513 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -2,15 +2,14 @@ package provider import ( "bytes" - "io/ioutil" - "strings" - "text/template" - "unicode" - "crypto/tls" "crypto/x509" "fmt" + "io/ioutil" "os" + "strings" + "text/template" + "unicode" "github.com/BurntSushi/toml" "github.com/containous/traefik/autogen" diff --git a/provider/zk.go b/provider/zk.go index 57ce396b3..5fd7e9648 100644 --- a/provider/zk.go +++ b/provider/zk.go @@ -2,6 +2,7 @@ package provider import ( "fmt" + "github.com/containous/traefik/safe" "github.com/containous/traefik/types" "github.com/docker/libkv/store" diff --git a/safe/routine.go b/safe/routine.go index 70937fbb6..290f3fe23 100644 --- a/safe/routine.go +++ b/safe/routine.go @@ -2,9 +2,10 @@ package safe import ( "context" - "github.com/containous/traefik/log" "runtime/debug" "sync" + + "github.com/containous/traefik/log" ) type routine struct { diff --git a/types/types.go b/types/types.go index a3aa626ee..da62e402b 100644 --- a/types/types.go +++ b/types/types.go @@ -4,9 +4,10 @@ import ( "encoding" "errors" "fmt" + "strings" + "github.com/docker/libkv/store" "github.com/ryanuber/go-glob" - "strings" ) // Backend holds backend configuration. diff --git a/version/version.go b/version/version.go index 7e4149caf..d821589e5 100644 --- a/version/version.go +++ b/version/version.go @@ -1,10 +1,11 @@ package version import ( + "net/url" + "github.com/containous/traefik/log" "github.com/google/go-github/github" goversion "github.com/hashicorp/go-version" - "net/url" ) var (