Open ugorji opened 12 years ago
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.
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:
diff --git a/godoc/server.go b/godoc/server.go
index 3b452e5e..d231425e 100644
--- a/godoc/server.go
+++ b/godoc/server.go
@@ -64,6 +64,7 @@ func (h *handlerServer) GetPageInfo(abspath, relpath string, mode PageInfoMode,
// Note: If goos/goarch aren't set, the current binary's GOOS/GOARCH
// are used.
ctxt := build.Default
+ ctxt.BuildTags = []string{"vartime"}
ctxt.IsAbsPath = pathpkg.IsAbs
ctxt.IsDir = func(path string) bool {
fi, err := h.c.fs.Stat(filepath.ToSlash(path))
Then use "go build" to build a local copy of godoc that is using the build tags you need.
Change https://golang.org/cl/129099 mentions this issue: x/tools/cmd/godoc: add -tags like go build
Good evening,
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 😊. See the CL https://golang.org/cl/129099
Below I've added some printscreens how the design looks like for HTML and CLI. If there are better ideas to display the build tag information, let me know.
It would be great if some one from the Go Team, etc can review the code.