go/build: Return MultiplePackageError on importing a dir containing multiple 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 issue 8286.
Hello bradfitz@golang.org, rsc@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
9 years, 7 months ago
(2014-10-07 15:54:46 UTC)
#1
please use // MultiplePackageError describes a directory containing // buildable Go source files for multiple ...
9 years, 7 months ago
(2014-10-07 16:19:00 UTC)
#2
please use
// MultiplePackageError describes a directory containing
// buildable Go source files for multiple packages.
type MultiplePackageError struct {
Dir string // directory containing files
Packages []string // package names found
Files []string // file mentioning each package: Files[i] declares
package Packages[i]
}
where right now it will always be the case that len(Packages) = len(Files)
= 2.
please keep the returned error string *exactly* the same as it is today.
the CL as written throws away useful information.
On 2014/10/07 16:19:00, rsc wrote: > please use > > // MultiplePackageError describes a directory ...
9 years, 7 months ago
(2014-10-07 16:22:51 UTC)
#3
On 2014/10/07 16:19:00, rsc wrote:
> please use
>
> // MultiplePackageError describes a directory containing
> // buildable Go source files for multiple packages.
> type MultiplePackageError struct {
> Dir string // directory containing files
> Packages []string // package names found
> Files []string // file mentioning each package: Files[i] declares
> package Packages[i]
> }
>
> where right now it will always be the case that len(Packages) = len(Files)
> = 2.
>
> please keep the returned error string *exactly* the same as it is today.
> the CL as written throws away useful information.
okay, you are right
*** Submitted as https://code.google.com/p/go/source/detail?r=60a10bf059e7 *** go/build: Return MultiplePackageError on importing a dir containing multiple packages ...
9 years, 6 months ago
(2014-10-15 03:25:03 UTC)
#15
*** Submitted as https://code.google.com/p/go/source/detail?r=60a10bf059e7 ***
go/build: Return MultiplePackageError on importing a dir containing multiple
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 issue 8286.
LGTM=adg, rsc
R=bradfitz, rsc, adg
CC=golang-codereviews
https://codereview.appspot.com/155050043
Committer: Russ Cox <rsc@golang.org>
Issue 155050043: code review 155050043: go/build: Return MultiplePackageError on importing a di...
(Closed)
Created 9 years, 7 months ago by jfrederich
Modified 9 years, 6 months ago
Reviewers: gobot
Base URL:
Comments: 6