]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "cmd/build: reject non-existant directories in ImportDir"
authorMikio Hara <mikioh.mikioh@gmail.com>
Fri, 13 May 2016 02:10:29 +0000 (11:10 +0900)
committerAndrew Gerrand <adg@golang.org>
Fri, 13 May 2016 17:30:23 +0000 (17:30 +0000)
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>
src/go/build/build.go
src/go/build/build_test.go

index 0818aa050178b9e7f5feea7486ba0384a878effd..fa258d3dc671a4d0f8a643fc34fdc08ad78f45c0 100644 (file)
@@ -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
index 6bade1d318c6e706aa90e80beedf44e955420a88..c9f906a7da6d0a5b498ac771c03cdd4ea07d51d1 100644 (file)
@@ -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)
-       }
-}