Skip to content

Commit 09c411d

Browse files
committedDec 21, 2016
Revert "cmd/go: note when some Go files were ignored on no-Go-files errors"
This reverts commit eee727d (https://golang.org/cl/29113) The " (.go files ignored due to build tags)" error message is not always accurate. Fixes golang#18396 Updates golang#17008 Change-Id: I609653120603a7f6094bc1dc3a83856f4b259241 Reviewed-on: https://go-review.googlesource.com/34662 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
·
go1.15.6go1.8rc1
1 parent 27fb26c commit 09c411d

File tree

4 files changed

+3
-23
lines changed

4 files changed

+3
-23
lines changed
 

‎api/go1.8.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ pkg expvar, method (*Float) Value() float64
176176
pkg expvar, method (Func) Value() interface{}
177177
pkg expvar, method (*Int) Value() int64
178178
pkg expvar, method (*String) Value() string
179-
pkg go/build, type NoGoError struct, Ignored bool
180179
pkg go/doc, func IsPredeclared(string) bool
181180
pkg go/types, func Default(Type) Type
182181
pkg go/types, func IdenticalIgnoreTags(Type, Type) bool

‎src/go/build/build.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,11 @@ func (ctxt *Context) ImportDir(dir string, mode ImportMode) (*Package, error) {
439439
// containing no buildable Go source files. (It may still contain
440440
// test files, files hidden by build tags, and so on.)
441441
type NoGoError struct {
442-
Dir string
443-
Ignored bool // whether any Go files were ignored due to build tags
442+
Dir string
444443
}
445444

446445
func (e *NoGoError) Error() string {
447-
msg := "no buildable Go source files in " + e.Dir
448-
if e.Ignored {
449-
msg += " (.go files ignored due to build tags)"
450-
}
451-
return msg
446+
return "no buildable Go source files in " + e.Dir
452447
}
453448

454449
// MultiplePackageError describes a directory containing
@@ -880,7 +875,7 @@ Found:
880875
return p, badGoError
881876
}
882877
if len(p.GoFiles)+len(p.CgoFiles)+len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
883-
return p, &NoGoError{Dir: p.Dir, Ignored: len(p.IgnoredGoFiles) > 0}
878+
return p, &NoGoError{p.Dir}
884879
}
885880

886881
for tag := range allTags {

‎src/go/build/build_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,6 @@ func TestEmptyFolderImport(t *testing.T) {
9393
}
9494
}
9595

96-
func TestIgnoredGoFilesImport(t *testing.T) {
97-
_, err := Import(".", "testdata/ignored", 0)
98-
e, ok := err.(*NoGoError)
99-
if !ok {
100-
t.Fatal(`Import("testdata/ignored") did not return NoGoError.`)
101-
}
102-
if !e.Ignored {
103-
t.Fatal(`Import("testdata/ignored") should have ignored Go files.`)
104-
}
105-
}
106-
10796
func TestMultiplePackageImport(t *testing.T) {
10897
_, err := Import(".", "testdata/multi", 0)
10998
mpe, ok := err.(*MultiplePackageError)

‎src/go/build/testdata/ignored/ignored.go

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.