Skip to content
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/vet: vet ignores build tags #4906

Closed
fsouza opened this issue Feb 25, 2013 · 4 comments

Comments

Projects
None yet
5 participants
@fsouza
Copy link
Contributor

commented Feb 25, 2013

If I have a package with a main.go file, declaring a package main and using "//
+build ignore", go vet fails to run in this package:

% go version
go version devel +a3c0a11b128a Sun Feb 24 21:57:16 2013 -0800 darwin/amd6
% cd $GOPATH/src/sample
% cat a.go
package sample
% cat main.go
// +build ignore

package main

func main() {

}
% go vet
vet: main.go:3:1: package main; expected sample
exit status 1
@fsouza

This comment has been minimized.

Copy link
Contributor Author

commented Feb 25, 2013

Comment 1:

Just another issue, it also ignore build constraints based on file name (please edit the
issue summary):
% cat a_linux.go
package sample
import "syscall"
var _ = syscall.TCGETS
% go vet
vet: a_linux.go:5:17: cannot refer to unexported TCGETS
exit status 1
The real issue is that TCGETS is not defined for darwin, but this should not be an
issue, because the file is named a_linux.go.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2013

Comment 2:

I did this on purpose, for issue #4007. Now that 'go vet' does typechecking we probably
have to undo it for that.

Labels changed: added priority-later, go1.1, removed priority-triage, go1.1maybe.

Status changed to Accepted.

@minux

This comment has been minimized.

Copy link
Member

commented Feb 25, 2013

Comment 3:

if 'go vet' obey build tags, then you can't check source code not
built on that particular platform/setting.
@robpike

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2013

Comment 4:

This issue was closed by revision f5afc7d.

Status changed to Fixed.

@fsouza fsouza added fixed labels Feb 25, 2013

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.