diff options
| author | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-05-13 11:10:29 +0900 |
|---|---|---|
| committer | Andrew Gerrand <adg@golang.org> | 2016-05-13 17:30:23 +0000 |
| commit | 2cc0f2209653f9f6931e0c3a1fb63e581a0fe87f (patch) | |
| tree | ea62a4bba24b0f023060030cfaed24e7f42689ca | |
| parent | be5782c330f2c743f81942f5bc1b9c1e04296d44 (diff) | |
| download | go-2cc0f2209653f9f6931e0c3a1fb63e581a0fe87f.tar.xz | |
Revert "cmd/build: reject non-existant directories in ImportDir"
This reverts commit 7af2ce3f159760033c903b3730bfb5995b4edd40.
The commit had a wrong prefix in the description line, probably
misreconginized something. As a result it broke golang.org/x/tools/godoc
and golang.org/x/tools/cmd/godoc like the following:
--- FAIL: TestCLI (10.90s)
--- FAIL: TestWeb (13.74s)
FAIL
FAIL golang.org/x/tools/cmd/godoc 36.428s
--- FAIL: TestCommandLine (0.00s)
FAIL
FAIL golang.org/x/tools/godoc 0.068s
Change-Id: I362a862a4ded8592dec7488a28e7a256adee148f
Reviewed-on: https://go-review.googlesource.com/23076
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
| -rw-r--r-- | src/go/build/build.go | 6 | ||||
| -rw-r--r-- | src/go/build/build_test.go | 11 |
2 files changed, 1 insertions, 16 deletions
diff --git a/src/go/build/build.go b/src/go/build/build.go index 0818aa0501..fa258d3dc6 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -403,11 +403,7 @@ func (p *Package) IsCommand() bool { // ImportDir is like Import but processes the Go package found in // the named directory. func (ctxt *Context) ImportDir(dir string, mode ImportMode) (*Package, error) { - p, err := ctxt.Import(".", dir, mode) - if err == nil && !ctxt.isDir(p.Dir) { - err = fmt.Errorf("%q is not a directory", p.Dir) - } - return p, err + return ctxt.Import(".", dir, mode) } // NoGoError is the error used by Import to describe a directory diff --git a/src/go/build/build_test.go b/src/go/build/build_test.go index 6bade1d318..c9f906a7da 100644 --- a/src/go/build/build_test.go +++ b/src/go/build/build_test.go @@ -5,7 +5,6 @@ package build import ( - "fmt" "internal/testenv" "io" "os" @@ -346,13 +345,3 @@ func TestImportVendorParentFailure(t *testing.T) { t.Fatalf("error on failed import does not mention GOROOT/src/vendor directory:\n%s", e) } } - -// Issue 3248 -func TestBogusDirectory(t *testing.T) { - const dir = "/foo/bar/baz/gopher" - _, err := ImportDir(dir, FindOnly) - want := fmt.Sprintf("%q is not a directory", filepath.FromSlash(dir)) - if err == nil || err.Error() != want { - t.Errorf("got error %q, want %q", err, want) - } -} |
