mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Revert "cmd/go: note when some Go files were ignored on no-Go-files errors"
This reverts commit eee727d0855b9e78f9df87e08d57b1d7f264876c (https://golang.org/cl/29113) The " (.go files ignored due to build tags)" error message is not always accurate. Fixes #18396 Updates #17008 Change-Id: I609653120603a7f6094bc1dc3a83856f4b259241 Reviewed-on: https://go-review.googlesource.com/34662 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
27fb26c77c
commit
09c411da1d
@ -176,7 +176,6 @@ pkg expvar, method (*Float) Value() float64
|
|||||||
pkg expvar, method (Func) Value() interface{}
|
pkg expvar, method (Func) Value() interface{}
|
||||||
pkg expvar, method (*Int) Value() int64
|
pkg expvar, method (*Int) Value() int64
|
||||||
pkg expvar, method (*String) Value() string
|
pkg expvar, method (*String) Value() string
|
||||||
pkg go/build, type NoGoError struct, Ignored bool
|
|
||||||
pkg go/doc, func IsPredeclared(string) bool
|
pkg go/doc, func IsPredeclared(string) bool
|
||||||
pkg go/types, func Default(Type) Type
|
pkg go/types, func Default(Type) Type
|
||||||
pkg go/types, func IdenticalIgnoreTags(Type, Type) bool
|
pkg go/types, func IdenticalIgnoreTags(Type, Type) bool
|
||||||
|
@ -440,15 +440,10 @@ func (ctxt *Context) ImportDir(dir string, mode ImportMode) (*Package, error) {
|
|||||||
// test files, files hidden by build tags, and so on.)
|
// test files, files hidden by build tags, and so on.)
|
||||||
type NoGoError struct {
|
type NoGoError struct {
|
||||||
Dir string
|
Dir string
|
||||||
Ignored bool // whether any Go files were ignored due to build tags
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *NoGoError) Error() string {
|
func (e *NoGoError) Error() string {
|
||||||
msg := "no buildable Go source files in " + e.Dir
|
return "no buildable Go source files in " + e.Dir
|
||||||
if e.Ignored {
|
|
||||||
msg += " (.go files ignored due to build tags)"
|
|
||||||
}
|
|
||||||
return msg
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MultiplePackageError describes a directory containing
|
// MultiplePackageError describes a directory containing
|
||||||
@ -880,7 +875,7 @@ Found:
|
|||||||
return p, badGoError
|
return p, badGoError
|
||||||
}
|
}
|
||||||
if len(p.GoFiles)+len(p.CgoFiles)+len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
|
if len(p.GoFiles)+len(p.CgoFiles)+len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
|
||||||
return p, &NoGoError{Dir: p.Dir, Ignored: len(p.IgnoredGoFiles) > 0}
|
return p, &NoGoError{p.Dir}
|
||||||
}
|
}
|
||||||
|
|
||||||
for tag := range allTags {
|
for tag := range allTags {
|
||||||
|
@ -93,17 +93,6 @@ func TestEmptyFolderImport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIgnoredGoFilesImport(t *testing.T) {
|
|
||||||
_, err := Import(".", "testdata/ignored", 0)
|
|
||||||
e, ok := err.(*NoGoError)
|
|
||||||
if !ok {
|
|
||||||
t.Fatal(`Import("testdata/ignored") did not return NoGoError.`)
|
|
||||||
}
|
|
||||||
if !e.Ignored {
|
|
||||||
t.Fatal(`Import("testdata/ignored") should have ignored Go files.`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMultiplePackageImport(t *testing.T) {
|
func TestMultiplePackageImport(t *testing.T) {
|
||||||
_, err := Import(".", "testdata/multi", 0)
|
_, err := Import(".", "testdata/multi", 0)
|
||||||
mpe, ok := err.(*MultiplePackageError)
|
mpe, ok := err.(*MultiplePackageError)
|
||||||
|
3
src/go/build/testdata/ignored/ignored.go
vendored
3
src/go/build/testdata/ignored/ignored.go
vendored
@ -1,3 +0,0 @@
|
|||||||
// +build alwaysignore
|
|
||||||
|
|
||||||
package ignored
|
|
Loading…
x
Reference in New Issue
Block a user