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: Return a specific error on Importing a dir containing multiple packages #8286

Closed
cespare opened this issue Jun 25, 2014 · 7 comments
Milestone

Comments

@cespare
Copy link
Contributor

cespare commented Jun 25, 2014

When one of the Import{Dir} functions/methods in go/build encounters a dir without any
buildable Go source files, it returns a handy NoGoError.

If, instead, it encounters multiple Go source files from multiple packages, it returns a
generic error with fmt.Errorf:

"found packages main (hello.go) and patexample (hello_appengine.go) in
/some/path/to/github.com/bmizerany/pat/example"

These are both error conditions I care about in my code, and I'd like to be able to
check for the latter without doing string matching on the error.
@gopherbot
Copy link

Comment 1 by mattyjwilliams:

I actually submitted a pull request for that repo a couple of days ago
bmizerany/pat#35

@cespare
Copy link
Contributor Author

cespare commented Jun 25, 2014

Comment 2:

Re #1: Thanks, and merged. (The issue still stands though.)

@ianlancetaylor
Copy link
Contributor

Comment 3:

Labels changed: added repo-main, release-go1.4.

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 4:

Owner changed to @rsc.

Status changed to Accepted.

@frederich
Copy link
Contributor

Comment 5:

I'll fix the issue.

@gopherbot
Copy link

Comment 6:

CL https://golang.org/cl/155050043 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Oct 15, 2014

Comment 7:

This issue was closed by revision 4f80b50.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
…ultiple packages

When the Import function in go/build encounters a directory
without any buildable Go source files, it returns a handy
NoGoError. Now if, instead it encounters multiple Go source files
from multiple packages, it returns a handy MultiplePackageError.

A new test for NoGoError and MultiplePackageError is also provided.

Fixes golang#8286.

LGTM=adg, rsc
R=bradfitz, rsc, adg
CC=golang-codereviews
https://golang.org/cl/155050043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
…ultiple packages

When the Import function in go/build encounters a directory
without any buildable Go source files, it returns a handy
NoGoError. Now if, instead it encounters multiple Go source files
from multiple packages, it returns a handy MultiplePackageError.

A new test for NoGoError and MultiplePackageError is also provided.

Fixes golang#8286.

LGTM=adg, rsc
R=bradfitz, rsc, adg
CC=golang-codereviews
https://golang.org/cl/155050043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
…ultiple packages

When the Import function in go/build encounters a directory
without any buildable Go source files, it returns a handy
NoGoError. Now if, instead it encounters multiple Go source files
from multiple packages, it returns a handy MultiplePackageError.

A new test for NoGoError and MultiplePackageError is also provided.

Fixes golang#8286.

LGTM=adg, rsc
R=bradfitz, rsc, adg
CC=golang-codereviews
https://golang.org/cl/155050043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
…ultiple packages

When the Import function in go/build encounters a directory
without any buildable Go source files, it returns a handy
NoGoError. Now if, instead it encounters multiple Go source files
from multiple packages, it returns a handy MultiplePackageError.

A new test for NoGoError and MultiplePackageError is also provided.

Fixes golang#8286.

LGTM=adg, rsc
R=bradfitz, rsc, adg
CC=golang-codereviews
https://golang.org/cl/155050043
@rsc rsc removed their assignment Jun 23, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants