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/go: add -tags to go vet #10228

Closed
c4milo opened this issue Mar 23, 2015 · 7 comments
Closed

cmd/go: add -tags to go vet #10228

c4milo opened this issue Mar 23, 2015 · 7 comments
Milestone

Comments

@c4milo
Copy link
Member

c4milo commented Mar 23, 2015

What version of Go are you using (go version)?

1.4.2

What operating system and processor architecture are you using?

OS X

What did you do?

I just ran go vet -x on my package

What did you expect to see?

I'm expecting to see 3 files being checked.

$ go vet -x
/usr/local/Cellar/go/1.4.2/libexec/pkg/tool/darwin_amd64/vet account.go account_test.go postgres.go

What did you see instead?

Only 2 files being checked.

@ianlancetaylor
Copy link
Contributor

Your subject line suggests that you are using build tags. Please give us a complete example that we can use to recreate the problem. Thanks.

(Looks like issue #4906 but that was meant to be fixed.)

@c4milo
Copy link
Member Author

c4milo commented Mar 23, 2015

File A

package main

import "fmt"

func main() {
  fmt.Println("I do nothing")
}

File B with build tag

// +build mytag

package main

import "fmt"

func ButWhy() {
    fmt.Printf("but why?")
}

go vet output:

Expected output

$ go vet -x
/usr/local/Cellar/go/1.4.2/libexec/pkg/tool/darwin_amd64/vet a.go b.go

@robpike robpike self-assigned this Mar 24, 2015
@robpike
Copy link
Contributor

robpike commented Mar 24, 2015

It's honoring the build tags, so it's not really a bug. But it should accept a -tags argument, like go build.
Will fix the subject of this issue to match.

@robpike robpike changed the title cmd/vet: Doesn't seem to be checking source files with build tags. cmd/vet: no way to control compilation using tags; need -tags flag Mar 24, 2015
@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

-tags is one of the 'build flags' but we don't want all of them.

@rsc rsc changed the title cmd/vet: no way to control compilation using tags; need -tags flag cmd/go: add -tags to go vet Apr 10, 2015
@rsc rsc added this to the Go1.5Maybe milestone Apr 10, 2015
@gopherbot
Copy link

CL https://golang.org/cl/10692 mentions this issue.

robpike added a commit to golang/tools that referenced this issue Jun 4, 2015
This is needed to control which files to test in the usual manner.
A followup CL on the main repo will add the flag to the go vet command.

Updates golang/go#10228

Change-Id: I820d3c74657b58de5e92276627368dedf4e2096c
Reviewed-on: https://go-review.googlesource.com/10692
Reviewed-by: Andrew Gerrand <adg@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/10697 mentions this issue.

@robpike robpike closed this as completed in bbc4351 Jun 5, 2015
@c4milo
Copy link
Member Author

c4milo commented Jun 5, 2015

💃 Thank you @robpike!

@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe Jun 6, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants