]> Cypherpunks repositories - gostls13.git/commitdiff
all: call flag.Parse from TestMain only if used
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 16 Nov 2016 15:26:41 +0000 (15:26 +0000)
committerIan Lance Taylor <iant@golang.org>
Wed, 16 Nov 2016 19:01:01 +0000 (19:01 +0000)
These don't use any flags in TestMain itself, so the call is redundant
as M.Run will do it.

Change-Id: I00f2ac7f846dc2c3ad3535eb8177616b2d900149
Reviewed-on: https://go-review.googlesource.com/33275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/go_test.go
src/cmd/objdump/objdump_test.go
src/cmd/vet/vet_test.go

index 320c04126588eaee9d6cd20d55a03bdd9edc24b9..6e747865da505ccde7c954f4e5a0075cc3a6dd3d 100644 (file)
@@ -6,7 +6,6 @@ package main_test
 
 import (
        "bytes"
-       "flag"
        "fmt"
        "go/build"
        "go/format"
@@ -67,8 +66,6 @@ func init() {
 // The TestMain function creates a go command for testing purposes and
 // deletes it after the tests have been run.
 func TestMain(m *testing.M) {
-       flag.Parse()
-
        if canRun {
                args := []string{"build", "-tags", "testgo", "-o", "testgo" + exeSuffix}
                if race.Enabled {
index 4b70862d09d50a81f808ebb91e38916387931bde..30b964d883bffdea3932ebc6ba50e6ce7735fd06 100644 (file)
@@ -21,7 +21,6 @@ import (
 var tmp, exe string // populated by buildObjdump
 
 func TestMain(m *testing.M) {
-       flag.Parse()
        if !testenv.HasGoBuild() {
                return
        }
index 853088d7680689be11df1f216ab20015064026be..725f013a7dfc71c6c5a364343de7dcf8c5d2261b 100644 (file)
@@ -6,7 +6,6 @@ package main_test
 
 import (
        "bytes"
-       "flag"
        "fmt"
        "internal/testenv"
        "os"
@@ -24,7 +23,6 @@ const (
 
 // We implement TestMain so remove the test binary when all is done.
 func TestMain(m *testing.M) {
-       flag.Parse()
        result := m.Run()
        os.Remove(binary)
        os.Exit(result)