From 6ebac90cb0efd95e65f10b027e8a629ee8c48183 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sun, 20 Mar 2016 14:34:27 +0000 Subject: [PATCH] refactor: eliminate dot imports in main packages --- prog/plugin/main.go | 6 ++++-- prog/weaveproxy/main.go | 12 ++++++------ prog/weaver/http.go | 1 - prog/weaver/main.go | 10 ++++++---- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/prog/plugin/main.go b/prog/plugin/main.go index e0697e29..82a594e7 100644 --- a/prog/plugin/main.go +++ b/prog/plugin/main.go @@ -11,7 +11,7 @@ import ( "github.com/docker/libnetwork/ipamapi" weaveapi "github.com/weaveworks/weave/api" - . "github.com/weaveworks/weave/common" + "github.com/weaveworks/weave/common" "github.com/weaveworks/weave/common/docker" weavenet "github.com/weaveworks/weave/net" ipamplugin "github.com/weaveworks/weave/plugin/ipam" @@ -21,6 +21,8 @@ import ( var version = "(unreleased version)" +var Log = common.Log + func main() { var ( justVersion bool @@ -43,7 +45,7 @@ func main() { os.Exit(0) } - SetLogLevel(logLevel) + common.SetLogLevel(logLevel) // API 1.21 is the first version that supports docker network commands dockerClient, err := docker.NewVersionedClientFromEnv("1.21") diff --git a/prog/weaveproxy/main.go b/prog/weaveproxy/main.go index 47ad90b3..a06042b9 100644 --- a/prog/weaveproxy/main.go +++ b/prog/weaveproxy/main.go @@ -6,14 +6,14 @@ import ( "strings" "github.com/docker/docker/pkg/mflag" - . "github.com/weaveworks/weave/common" + "github.com/weaveworks/weave/common" "github.com/weaveworks/weave/common/mflagext" "github.com/weaveworks/weave/proxy" ) -var ( - version = "(unreleased version)" -) +var version = "(unreleased version)" + +var Log = common.Log func getenv(key, defaultVal string) string { if v := os.Getenv(key); v != "" { @@ -56,7 +56,7 @@ func main() { os.Exit(0) } - SetLogLevel(logLevel) + common.SetLogLevel(logLevel) Log.Infoln("weave proxy", version) Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " ")) @@ -79,5 +79,5 @@ func main() { p.AttachExistingContainers() go p.Serve(listeners) go p.ListenAndServeStatus("/home/weave/status.sock") - SignalHandlerLoop() + common.SignalHandlerLoop() } diff --git a/prog/weaver/http.go b/prog/weaver/http.go index 4ae0e251..57945539 100644 --- a/prog/weaver/http.go +++ b/prog/weaver/http.go @@ -11,7 +11,6 @@ import ( "github.com/gorilla/mux" "github.com/weaveworks/mesh" - . "github.com/weaveworks/weave/common" "github.com/weaveworks/weave/ipam" "github.com/weaveworks/weave/nameserver" "github.com/weaveworks/weave/net/address" diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 3d98c03b..b3d77f5c 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -16,7 +16,7 @@ import ( "github.com/weaveworks/mesh" "github.com/weaveworks/go-checkpoint" - . "github.com/weaveworks/weave/common" + "github.com/weaveworks/weave/common" "github.com/weaveworks/weave/common/docker" "github.com/weaveworks/weave/db" "github.com/weaveworks/weave/ipam" @@ -28,6 +28,8 @@ import ( var version = "(unreleased version)" +var Log = common.Log + type dnsConfig struct { Domain string ListenAddress string @@ -147,7 +149,7 @@ func main() { peers = mflag.Args() - SetLogLevel(logLevel) + common.SetLogLevel(logLevel) if justVersion { fmt.Printf("weave router %s\n", version) @@ -255,7 +257,7 @@ func main() { router.Start() if errors := router.InitiateConnections(peers, false); len(errors) > 0 { - Log.Fatal(ErrorMessages(errors)) + Log.Fatal(common.ErrorMessages(errors)) } // The weave script always waits for a status call to succeed, @@ -276,7 +278,7 @@ func main() { go listenAndServeHTTP(httpAddr, muxRouter) } - SignalHandlerLoop(router) + common.SignalHandlerLoop(router) } func options() map[string]string {