update flag tables with Go 1.20

`go help build` now has -C, -cover, -coverpkg, and -pgo.

There are no new boolean flags, but note that -cover is now a common
build flag rather than just a test flag.

While here, sort the lists so that they are easier to skim for missing
items in the future.
pull/671/head
Daniel Martí 2 years ago committed by lu4p
parent 4919be0658
commit 6d54a77771

@ -2212,7 +2212,7 @@ func alterTrimpath(flags []string) []string {
return flagSetValue(flags, "-trimpath", sharedTempDir+"=>;"+trimpath) return flagSetValue(flags, "-trimpath", sharedTempDir+"=>;"+trimpath)
} }
// forwardBuildFlags is obtained from 'go help build' as of Go 1.18beta1. // forwardBuildFlags is obtained from 'go help build' as of Go 1.20.
var forwardBuildFlags = map[string]bool{ var forwardBuildFlags = map[string]bool{
// These shouldn't be used in nested cmd/go calls. // These shouldn't be used in nested cmd/go calls.
"-a": false, "-a": false,
@ -2225,14 +2225,13 @@ var forwardBuildFlags = map[string]bool{
"-toolexec": false, "-toolexec": false,
"-buildvcs": false, "-buildvcs": false,
"-p": true, "-C": true,
"-race": true,
"-msan": true,
"-asan": true, "-asan": true,
"-work": true,
"-asmflags": true, "-asmflags": true,
"-buildmode": true, "-buildmode": true,
"-compiler": true, "-compiler": true,
"-cover": true,
"-coverpkg": true,
"-gccgoflags": true, "-gccgoflags": true,
"-gcflags": true, "-gcflags": true,
"-installsuffix": true, "-installsuffix": true,
@ -2241,36 +2240,41 @@ var forwardBuildFlags = map[string]bool{
"-mod": true, "-mod": true,
"-modcacherw": true, "-modcacherw": true,
"-modfile": true, "-modfile": true,
"-msan": true,
"-overlay": true,
"-p": true,
"-pgo": true,
"-pkgdir": true, "-pkgdir": true,
"-race": true,
"-tags": true, "-tags": true,
"-work": true,
"-workfile": true, "-workfile": true,
"-overlay": true,
} }
// booleanFlags is obtained from 'go help build' and 'go help testflag' as of Go 1.19beta1. // booleanFlags is obtained from 'go help build' and 'go help testflag' as of Go 1.20.
var booleanFlags = map[string]bool{ var booleanFlags = map[string]bool{
// Shared build flags. // Shared build flags.
"-a": true, "-a": true,
"-asan": true,
"-buildvcs": true,
"-cover": true,
"-i": true, "-i": true,
"-linkshared": true,
"-modcacherw": true,
"-msan": true,
"-n": true, "-n": true,
"-race": true,
"-trimpath": true,
"-v": true, "-v": true,
"-work": true, "-work": true,
"-x": true, "-x": true,
"-race": true,
"-msan": true,
"-asan": true,
"-linkshared": true,
"-modcacherw": true,
"-trimpath": true,
"-buildvcs": true,
// Test flags (TODO: support its special -args flag) // Test flags (TODO: support its special -args flag)
"-benchmem": true,
"-c": true, "-c": true,
"-json": true,
"-cover": true,
"-failfast": true, "-failfast": true,
"-json": true,
"-short": true, "-short": true,
"-benchmem": true,
} }
func filterForwardBuildFlags(flags []string) (filtered []string, firstUnknown string) { func filterForwardBuildFlags(flags []string) (filtered []string, firstUnknown string) {

Loading…
Cancel
Save