aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2023-02-08 14:36:47 -0500
committerDavid Chase <drchase@google.com>2023-02-10 17:41:09 +0000
commit7628627cb236662002b53686ff0618834a9aa077 (patch)
tree0e62fedff613e5f86c3c0f915de741cb37f48d54
parent1fa2deb1b1a620511a3c45fcbae895e78d4f5d40 (diff)
downloadgo-7628627cb236662002b53686ff0618834a9aa077.tar.gz
go-7628627cb236662002b53686ff0618834a9aa077.zip
[release-branch.go1.20] cmd/go/internal/test: refresh flagdefs.go and fix test
The tests for cmd/go/internal/test were not running at all due to a missed call to m.Run in TestMain. That masked a missing vet analyzer ("timeformat") and a missed update to the generator script in CL 355452. Fixes #58421. Updates #58415. Change-Id: I7b0315952967ca07a866cdaa5903478b2873eb7a Reviewed-on: https://go-review.googlesource.com/c/go/+/466635 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> (cherry picked from commit 910f041ff0cdf90dbcd3bd22a272b9b7205a5add) Reviewed-on: https://go-review.googlesource.com/c/go/+/466855
-rw-r--r--src/cmd/go/internal/test/flagdefs.go1
-rw-r--r--src/cmd/go/internal/test/flagdefs_test.go4
-rw-r--r--src/cmd/go/internal/test/genflags.go2
3 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/go/internal/test/flagdefs.go b/src/cmd/go/internal/test/flagdefs.go
index b91204ee93..3f3709fe7e 100644
--- a/src/cmd/go/internal/test/flagdefs.go
+++ b/src/cmd/go/internal/test/flagdefs.go
@@ -66,6 +66,7 @@ var passAnalyzersToVet = map[string]bool{
"structtag": true,
"testinggoroutine": true,
"tests": true,
+ "timeformat": true,
"unmarshal": true,
"unreachable": true,
"unsafeptr": true,
diff --git a/src/cmd/go/internal/test/flagdefs_test.go b/src/cmd/go/internal/test/flagdefs_test.go
index 337f136d06..d5facb7161 100644
--- a/src/cmd/go/internal/test/flagdefs_test.go
+++ b/src/cmd/go/internal/test/flagdefs_test.go
@@ -9,6 +9,7 @@ import (
"cmd/go/internal/test/internal/genflags"
"flag"
"internal/testenv"
+ "os"
"reflect"
"strings"
"testing"
@@ -16,6 +17,7 @@ import (
func TestMain(m *testing.M) {
cfg.SetGOROOT(testenv.GOROOT(nil), false)
+ os.Exit(m.Run())
}
func TestPassFlagToTestIncludesAllTestFlags(t *testing.T) {
@@ -48,6 +50,8 @@ func TestPassFlagToTestIncludesAllTestFlags(t *testing.T) {
}
func TestVetAnalyzersSetIsCorrect(t *testing.T) {
+ testenv.MustHaveGoBuild(t) // runs 'go tool vet -flags'
+
vetAns, err := genflags.VetAnalyzers()
if err != nil {
t.Fatal(err)
diff --git a/src/cmd/go/internal/test/genflags.go b/src/cmd/go/internal/test/genflags.go
index 8c7554919a..625f94133a 100644
--- a/src/cmd/go/internal/test/genflags.go
+++ b/src/cmd/go/internal/test/genflags.go
@@ -75,7 +75,7 @@ func testFlags() []string {
}
switch name {
- case "testlogfile", "paniconexit0", "fuzzcachedir", "fuzzworker":
+ case "testlogfile", "paniconexit0", "fuzzcachedir", "fuzzworker", "gocoverdir":
// These flags are only for use by cmd/go.
default:
names = append(names, name)