Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/cmd/godoc: add -tags like go build #3398
Before filing a bug, please check whether it has been fixed since the latest release: run "hg pull", "hg update default", rebuild, and retry what you did to reproduce the problem. Thanks. What steps will reproduce the problem? If possible, include a link to a program on play.golang.org. 1. Run godoc on a package having some files with build constraints e.g. // +build ignore 2. The files are skipped by godoc and their contents are not reflected in godoc output. I don't see the files listed either. 3. What is the expected output? I expected to see the information in godoc. What do you see instead? Nothing. Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Linux Which version are you using? (run 'go version') Running at tip, but go version gives: go version weekly.2012-03-22 +de7e784537ac Please provide any additional information below.
godoc ignores files that say "// +build ignore". It uses the files that would be built by go build. That seems like it is working as intended. Maybe after Go 1 we could give godoc a flag to allow the specification of additional build tags, like go build's -tags. Russ
Labels changed: added priority-later, removed priority-triage.
Status changed to Accepted.
referenced this issue
Jan 9, 2015
changed the title from
cmd/godoc: add -tags like go build
x/tools/cmd/godoc: add -tags like go build
Apr 14, 2015
If you are someone like me who just stumbled across this old bug and are looking for a quick hack to solve your problem right now, use "go get golang.org/x/tools" to get the godoc source code then hack it like this:
Then use "go build" to build a local copy of godoc that is using the build tags you need.
as I currently need this feature in godoc to display documentation for specific build tags, I've added it to godoc. It took me a couple of days and I think it is ready for review
Below I've added some printscreens how the design looks like for HTML and CLI.
It would be great if some one from the Go Team, etc can review the code.