From d5b7bf51aa7dc6217fea04e3e3b6e43289a25746 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 11 Oct 2019 13:27:54 -0400 Subject: [PATCH] Move flag.Parse in tests to TestMain This this fixes issues with custom and testing flags in Go 1.3 and should work in previous go versions. Signed-off-by: Michael Crosby --- client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client_test.go b/client_test.go index 182e5ca75..fd9cb7643 100644 --- a/client_test.go +++ b/client_test.go @@ -54,7 +54,6 @@ func init() { flag.StringVar(&address, "address", defaultAddress, "The address to the containerd socket for use in the tests") flag.BoolVar(&noDaemon, "no-daemon", false, "Do not start a dedicated daemon for the tests") flag.BoolVar(&noCriu, "no-criu", false, "Do not run the checkpoint tests") - flag.Parse() } func testContext(t testing.TB) (context.Context, context.CancelFunc) { @@ -67,6 +66,7 @@ func testContext(t testing.TB) (context.Context, context.CancelFunc) { } func TestMain(m *testing.M) { + flag.Parse() if testing.Short() { os.Exit(m.Run()) }