refactor: eliminate dot imports in main packages

This commit is contained in:
Matthias Radestock committed 2016-03-20 14:34:27 +00:00
1 parent 5e0231ec5e
commit 6ebac90cb0
4 files changed
+16 -13

No files matched your search

+4 -2
View File
@@ -11,7 +11,7 @@ import (
"github.com/docker/libnetwork/ipamapi" "github.com/docker/libnetwork/ipamapi"
weaveapi "github.com/weaveworks/weave/api" weaveapi "github.com/weaveworks/weave/api"
. "github.com/weaveworks/weave/common" "github.com/weaveworks/weave/common"
"github.com/weaveworks/weave/common/docker" "github.com/weaveworks/weave/common/docker"
weavenet "github.com/weaveworks/weave/net" weavenet "github.com/weaveworks/weave/net"
ipamplugin "github.com/weaveworks/weave/plugin/ipam" ipamplugin "github.com/weaveworks/weave/plugin/ipam"
@@ -21,6 +21,8 @@ import (
var version = "(unreleased version)" var version = "(unreleased version)"
var Log = common.Log
func main() { func main() {
var ( var (
justVersion bool justVersion bool
@@ -43,7 +45,7 @@ func main() {
os.Exit(0) os.Exit(0)
} }
SetLogLevel(logLevel) common.SetLogLevel(logLevel)
// API 1.21 is the first version that supports docker network commands // API 1.21 is the first version that supports docker network commands
dockerClient, err := docker.NewVersionedClientFromEnv("1.21") dockerClient, err := docker.NewVersionedClientFromEnv("1.21")
+6 -6
View File
@@ -6,14 +6,14 @@ import (
"strings" "strings"
"github.com/docker/docker/pkg/mflag" "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/common/mflagext"
"github.com/weaveworks/weave/proxy" "github.com/weaveworks/weave/proxy"
) )
var ( var version = "(unreleased version)"
version = "(unreleased version)"
) var Log = common.Log
func getenv(key, defaultVal string) string { func getenv(key, defaultVal string) string {
if v := os.Getenv(key); v != "" { if v := os.Getenv(key); v != "" {
@@ -56,7 +56,7 @@ func main() {
os.Exit(0) os.Exit(0)
} }
SetLogLevel(logLevel) common.SetLogLevel(logLevel)
Log.Infoln("weave proxy", version) Log.Infoln("weave proxy", version)
Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " ")) Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " "))
@@ -79,5 +79,5 @@ func main() {
p.AttachExistingContainers() p.AttachExistingContainers()
go p.Serve(listeners) go p.Serve(listeners)
go p.ListenAndServeStatus("/home/weave/status.sock") go p.ListenAndServeStatus("/home/weave/status.sock")
SignalHandlerLoop() common.SignalHandlerLoop()
} }
-1
View File
@@ -11,7 +11,6 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/weaveworks/mesh" "github.com/weaveworks/mesh"
. "github.com/weaveworks/weave/common"
"github.com/weaveworks/weave/ipam" "github.com/weaveworks/weave/ipam"
"github.com/weaveworks/weave/nameserver" "github.com/weaveworks/weave/nameserver"
"github.com/weaveworks/weave/net/address" "github.com/weaveworks/weave/net/address"
+6 -4
View File
@@ -16,7 +16,7 @@ import (
"github.com/weaveworks/mesh" "github.com/weaveworks/mesh"
"github.com/weaveworks/go-checkpoint" "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/common/docker"
"github.com/weaveworks/weave/db" "github.com/weaveworks/weave/db"
"github.com/weaveworks/weave/ipam" "github.com/weaveworks/weave/ipam"
@@ -28,6 +28,8 @@ import (
var version = "(unreleased version)" var version = "(unreleased version)"
var Log = common.Log
type dnsConfig struct { type dnsConfig struct {
Domain string Domain string
ListenAddress string ListenAddress string
@@ -147,7 +149,7 @@ func main() {
peers = mflag.Args() peers = mflag.Args()
SetLogLevel(logLevel) common.SetLogLevel(logLevel)
if justVersion { if justVersion {
fmt.Printf("weave router %s\n", version) fmt.Printf("weave router %s\n", version)
@@ -255,7 +257,7 @@ func main() {
router.Start() router.Start()
if errors := router.InitiateConnections(peers, false); len(errors) > 0 { 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, // The weave script always waits for a status call to succeed,
@@ -276,7 +278,7 @@ func main() {
go listenAndServeHTTP(httpAddr, muxRouter) go listenAndServeHTTP(httpAddr, muxRouter)
} }
SignalHandlerLoop(router) common.SignalHandlerLoop(router)
} }
func options() map[string]string { func options() map[string]string {