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>
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.
--- /dev/null
+// 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() {
+}
})
}
}
+
+// 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)
+ }
+}