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

x/pkgsite/cmd/pkgsite: document ignored items #65198

Closed
3052 opened this issue Jan 22, 2024 · 2 comments
Closed

x/pkgsite/cmd/pkgsite: document ignored items #65198

3052 opened this issue Jan 22, 2024 · 2 comments

Comments

@3052
Copy link

3052 commented Jan 22, 2024

Proposal Details

it seems currently items ignored by the pkgsite tool are not documented. I did this search:

\"\.\" \"internal\" \"testdata\"

here:

https://cs.opensource.google/go

from my own testing, a folder like this is built and indexed:

_hello

a folder like this is built, but optionally indexed:

internal

and these are not built or indexed:

.hello
testdata
@3052 3052 added the Proposal label Jan 22, 2024
@gopherbot gopherbot added this to the Unreleased milestone Jan 22, 2024
@3052
Copy link
Author

3052 commented Jan 22, 2024

I think this is it:

// ignoredByGoTool reports whether the given import path corresponds
// to a directory that would be ignored by the go tool.
//
// The logic of the go tool for ignoring directories is documented at
// https://golang.org/cmd/go/#hdr-Package_lists_and_patterns:
//
//      Directory and file names that begin with "." or "_" are ignored
//      by the go tool, as are directories named "testdata".
//
// However, even though `go list` and other commands that take package
// wildcards will ignore these, they can still be imported and used in
// working Go programs. We continue to ignore the "." and "testdata"
// cases, but we've seen valid Go packages with "_", so we accept those.

https://github.com/golang/pkgsite/blob/24c36df908d0532d634e80b2b0598474b661736a/internal/fetch/package.go#L270-L282

@ianlancetaylor
Copy link
Contributor

This is documented at https://pkg.go.dev/cmd/go#hdr-Package_lists_and_patterns. The pkgsite tool is treating files the way that the go tool does, so that they are both consistent.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants