From 97bece2d7ba93558a20ccdd51efbf82610bb8697 Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Mon, 5 Jan 2015 13:49:31 +0000 Subject: [PATCH] Move testing utils to its own package So as not to pollute command-line flags with test.* options. It appears that importing "testing" (from stdlib) will add flags. To avoid this, we need code to not depend on testing. But, since testing_utils was previously in the same package as the rest of the code, it dragged testing in. Renaming testing_util.go to e.g., util_for_test.go might be enough to avoid it being compiled with the regular code. We may want it to be available to tests for other packages -- after all it is utilities for testing -- so it goes in its own package. --- Makefile | 2 +- nameserver/http_test.go | 2 +- nameserver/mdns_client_test.go | 2 +- nameserver/mdns_server_test.go | 2 +- nameserver/zone_test.go | 2 +- common/testing_utils.go => testing/util.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename common/testing_utils.go => testing/util.go (99%) diff --git a/Makefile b/Makefile index 4fc0eec6..082a176e 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ all: $(WEAVER_EXPORT) $(WEAVEDNS_EXPORT) $(WEAVETOOLS_EXPORT) update: go get -u -f -v -tags -netgo ./$(dir $(WEAVER_EXE)) ./$(dir $(WEAVEDNS_EXE)) -$(WEAVER_EXE) $(WEAVEDNS_EXE): +$(WEAVER_EXE) $(WEAVEDNS_EXE): common/*.go go get -tags netgo ./$(@D) go build -ldflags "-extldflags \"-static\" -X main.version $(WEAVE_VERSION)" -tags netgo -o $@ ./$(shell dirname $@) @strings $@ | grep cgo_stub\\\.go >/dev/null || { \ diff --git a/nameserver/http_test.go b/nameserver/http_test.go index d5ee5dfd..a2d14380 100644 --- a/nameserver/http_test.go +++ b/nameserver/http_test.go @@ -2,7 +2,7 @@ package nameserver import ( "fmt" - wt "github.com/zettio/weave/common" + wt "github.com/zettio/weave/testing" "math/rand" "net" "net/http" diff --git a/nameserver/mdns_client_test.go b/nameserver/mdns_client_test.go index 012bc107..e684f8b4 100644 --- a/nameserver/mdns_client_test.go +++ b/nameserver/mdns_client_test.go @@ -2,7 +2,7 @@ package nameserver import ( "github.com/miekg/dns" - wt "github.com/zettio/weave/common" + wt "github.com/zettio/weave/testing" "log" "net" "testing" diff --git a/nameserver/mdns_server_test.go b/nameserver/mdns_server_test.go index 4319b609..873e5067 100644 --- a/nameserver/mdns_server_test.go +++ b/nameserver/mdns_server_test.go @@ -2,7 +2,7 @@ package nameserver import ( "github.com/miekg/dns" - wt "github.com/zettio/weave/common" + wt "github.com/zettio/weave/testing" "log" "net" "testing" diff --git a/nameserver/zone_test.go b/nameserver/zone_test.go index 86db36ec..c5298c1e 100644 --- a/nameserver/zone_test.go +++ b/nameserver/zone_test.go @@ -1,7 +1,7 @@ package nameserver import ( - wt "github.com/zettio/weave/common" + wt "github.com/zettio/weave/testing" "net" "testing" ) diff --git a/common/testing_utils.go b/testing/util.go similarity index 99% rename from common/testing_utils.go rename to testing/util.go index fc03ba9b..ef6cf332 100644 --- a/common/testing_utils.go +++ b/testing/util.go @@ -1,4 +1,4 @@ -package common +package testing import ( "fmt"