mirror of https://github.com/golang/go.git
cmd/vet: don't exit with failure on type checking error
The vet tool only reports a type checking error when invoked with -v. Don't let that by itself cause vet to exit with an error exit status. Updates #21188 Change-Id: I172c13d46c35d49e229e96e833683d8c82a77de7 Reviewed-on: https://go-review.googlesource.com/52851 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
a8730cd93a
commit
664cd26c89
|
|
@ -349,8 +349,9 @@ func doPackage(directory string, names []string, basePkg *Package) *Package {
|
|||
pkg.files = files
|
||||
// Type check the package.
|
||||
err := pkg.check(fs, astFiles)
|
||||
if err != nil && *verbose {
|
||||
warnf("%s", err)
|
||||
if err != nil {
|
||||
// Note that we only report this error when *verbose.
|
||||
Println(err)
|
||||
}
|
||||
|
||||
// Check.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2017 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Used by TestVetVerbose to test that vet -v doesn't fail because it
|
||||
// can't find "C".
|
||||
|
||||
package testdata
|
||||
|
||||
import "C"
|
||||
|
||||
func F() {
|
||||
}
|
||||
|
|
@ -205,3 +205,15 @@ func TestTags(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #21188.
|
||||
func TestVetVerbose(t *testing.T) {
|
||||
t.Parallel()
|
||||
Build(t)
|
||||
cmd := exec.Command("./"+binary, "-v", "-all", "testdata/cgo/cgo3.go")
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Logf("%s", out)
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue