]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.20] cmd/go/internal/test: refresh flagdefs.go and fix test
authorBryan C. Mills <bcmills@google.com>
Wed, 8 Feb 2023 19:36:47 +0000 (14:36 -0500)
committerDavid Chase <drchase@google.com>
Fri, 10 Feb 2023 17:41:09 +0000 (17:41 +0000)
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

src/cmd/go/internal/test/flagdefs.go
src/cmd/go/internal/test/flagdefs_test.go
src/cmd/go/internal/test/genflags.go

index b91204ee93758d7fc65d4d42334cf5f8ec62e16b..3f3709fe7e28b51dc0271984416b57f648d78f91 100644 (file)
@@ -66,6 +66,7 @@ var passAnalyzersToVet = map[string]bool{
        "structtag":        true,
        "testinggoroutine": true,
        "tests":            true,
+       "timeformat":       true,
        "unmarshal":        true,
        "unreachable":      true,
        "unsafeptr":        true,
index 337f136d06177aecddb6637aa365e5c409ea5bc8..d5facb7161ab18f714214103f6bcc3294ddd42fa 100644 (file)
@@ -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)
index 8c7554919a5c8cca0fe26fa6ece502327044c905..625f94133a147982902ad06474d61fb7773e9e16 100644 (file)
@@ -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)