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: inconsistency on whether NoGoError includes test files #31921

Open
bradfitz opened this issue May 8, 2019 · 1 comment
Open

go/build: inconsistency on whether NoGoError includes test files #31921

bradfitz opened this issue May 8, 2019 · 1 comment

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented May 8, 2019

The code & documentation disagree about whether go/build.NoGoError includes tests.

Code says:

        if len(p.GoFiles)+len(p.CgoFiles)+len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
                return p, &NoGoError{p.Dir}
        }

But docs say:

// NoGoError is the error used by Import to describe a directory                                                                                                                                                                        
// containing no buildable Go source files. (It may still contain                                                                                                                                                                       
// test files, files hidden by build tags, and so on.)                                                                                                                                                                                  
type NoGoError struct {
        Dir string
}

(Notably, the "it may still contain test files" part, implying that a directory with only foo_test.go should be NoGoError).

/cc @bcmills @jayconrod @rsc @ianlancetaylor

@bcmills
Copy link
Member

@bcmills bcmills commented May 8, 2019

This is closely related to #29268, I think.

@bcmills bcmills added this to the Go1.13 milestone May 8, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants