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

go/build: go files in package documentation ignored; still desired behavior? #11801

tarakju opened this issue Jul 21, 2015 · 5 comments


Copy link

tarakju commented Jul 21, 2015

I tried to make a package called documentation today. Looks like .go files in any package called documentation are ignored. @aclements helped me do some sleuthing and discovered the original reason for a magic documentation package:

There is a comment in go/build that mentions this behavior. However, go help packages does not include this behavior in its list of reserved names.

It was unclear if this behavior is still desired (perhaps for backwards compatibility?), or if it should be removed. At the very least, seems like the documentation should be updated if this is still correct.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 21, 2015
Copy link

@tarakju's case was particularly confusing because he was actually in a directory called "documentation" creating a "package documentation" source file and go build was telling him there were no buildable go files. There were no hints that this might be a special case (and no documentation where the other special cases of go build are documented). The original intent of this rule was to let you put a "package documentation" source file alongside "package main" source files in a directory presumably called neither "documentation" or "main", so the user was clearly opting in to some special case.

Copy link

rsc commented Nov 5, 2015

We should remove this special case.

Copy link

adg commented Nov 5, 2015

Can we remove the special case while preserving compatibility? I guess we could make the tool ignore .go files in package documentation only if there are files from another package in the same directory.

Copy link

rsc commented Dec 17, 2015

I chickened out and documented this instead.

Copy link

CL mentions this issue.

@rsc rsc closed this as completed in e357eb9 Dec 17, 2015
@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

6 participants