-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: vet checks do not run when compiling tests to output a binary #26451
Comments
Additionally, the error you expected to see looks a bit broken to me—looks like a bad format string. cc @mvdan |
I think that the formatting error was fixed in the latest master but I'm still using 1.11 Beta 1. I'll revisit this for Beta 2 / RC 1. |
I cannot reproduce this on ...go/src/demo % cat demo.go
//+build hello
package demo
import "testing"
type Demo struct {
Field string
}
func NewDemo(v string) *Demo {
return &Demo{
Field: v,
}
}
func TestDemo(t *testing.T) {
v := NewDemo("hello world")
t.Log(v)
}
...go/src/demo % go test -c -o test.bin
# demo
./demo.go:1: +build comment must appear before package clause and be followed by a blank line
...go/src/demo % ls
demo.go |
@ysmolsky this is probably because the code was in a non |
Right. I am sorry! Here we go:
Reproduced. |
Change https://golang.org/cl/125215 mentions this issue: |
Issue cannot be reproduced when using |
The issue is still present in Go 1.11.1. Place the code exactly as it's written in a |
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
go version go1.11beta1 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?OS/ARCH independent
What did you do?
Using a simple broken build tag such as this, place the code in a
demo_test.go
file:Run
go test -c -o binary.name
.What did you expect to see?
I expect to see the following error:
What did you see instead?
Compilation and running tests from the test binary via
binary.name -test.v
works without issues.This behavior is inconsistent and leads to issues when a user compiles the test binary to run it after. I would expect the test binary to be prevented from being created by the same
vet
checks.The text was updated successfully, but these errors were encountered: