diff options
author | Russ Cox <rsc@golang.org> | 2017-12-01 12:17:37 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-12-01 21:06:03 +0000 |
commit | 76dc4b1952b93a4e804ecb9a6126620ef9399d36 (patch) | |
tree | 4003f1597c79732aedfeb2fab1b7c35cfc6c4b78 /src/cmd/vet/main.go | |
parent | 2f8bcc89408274821e91be464f51b4e2a816cbae (diff) | |
download | go-76dc4b1952b93a4e804ecb9a6126620ef9399d36.tar.gz go-76dc4b1952b93a4e804ecb9a6126620ef9399d36.zip |
cmd/go: ignore vet typecheck failure during go test
For Go 1.10, works around a go/types bug that can't typecheck
a corner-case type cycle. Once we are confident that bugs like
this are gone from go/types then we can stop ignoring these
failures.
For #22890.
Change-Id: I38da57e01a0636323e1af4484c30871786125df3
Reviewed-on: https://go-review.googlesource.com/81500
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/vet/main.go')
-rw-r--r-- | src/cmd/vet/main.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go index 66f9449d7e..a10c798850 100644 --- a/src/cmd/vet/main.go +++ b/src/cmd/vet/main.go @@ -35,6 +35,8 @@ var ( tagList = []string{} // exploded version of tags flag; set in main mustTypecheck bool + + succeedOnTypecheckFailure bool // during go test, we ignore potential bugs in go/types ) var exitCode = 0 @@ -291,6 +293,8 @@ type vetConfig struct { ImportMap map[string]string PackageFile map[string]string + SucceedOnTypecheckFailure bool + imp types.Importer } @@ -336,6 +340,7 @@ func doPackageCfg(cfgFile string) { if err := json.Unmarshal(js, &vcfg); err != nil { errorf("parsing vet config %s: %v", cfgFile, err) } + succeedOnTypecheckFailure = vcfg.SucceedOnTypecheckFailure stdImporter = &vcfg inittypes() mustTypecheck = true @@ -427,6 +432,9 @@ func doPackage(names []string, basePkg *Package) *Package { // Type check the package. errs := pkg.check(fs, astFiles) if errs != nil { + if succeedOnTypecheckFailure { + os.Exit(0) + } if *verbose || mustTypecheck { for _, err := range errs { fmt.Fprintf(os.Stderr, "%v\n", err) |