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
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bradfitz
Copy link
Contributor

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 commented May 8, 2019

This is closely related to #29268, I think.

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 8, 2019
@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
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants