]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: adjust import comment error
authorRuss Cox <rsc@golang.org>
Tue, 12 Aug 2014 23:52:04 +0000 (19:52 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 12 Aug 2014 23:52:04 +0000 (19:52 -0400)
Fixes #7453.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/127210043

src/cmd/go/pkg.go
src/cmd/go/test.bash

index eb8c451783f7a18dc0378301277ef0947993ab54..1af33f037a3674d26520d2d1c5cf43f87d816dc0 100644 (file)
@@ -267,7 +267,7 @@ func loadImport(path string, srcDir string, stk *importStack, importPos []token.
                bp.BinDir = gobin
        }
        if err == nil && !isLocal && bp.ImportComment != "" && bp.ImportComment != path {
-               err = fmt.Errorf("directory %s contains package %q", bp.Dir, bp.ImportComment)
+               err = fmt.Errorf("code in directory %s expects import %q", bp.Dir, bp.ImportComment)
        }
        p.load(stk, bp, err)
        if p.Error != nil && len(importPos) > 0 {
index 93a7c67c18506dbf9c6a4a307910aad07d295866..2bb929fb032eeb134bd78f401b4711b099564dd3 100755 (executable)
@@ -131,7 +131,7 @@ TEST 'import comment - mismatch'
 if ./testgo build ./testdata/importcom/wrongplace.go 2>testdata/err; then
        echo 'go build ./testdata/importcom/wrongplace.go suceeded'
        ok=false
-elif ! grep 'wrongplace contains package "my/x"' testdata/err >/dev/null; then
+elif ! grep 'wrongplace expects import "my/x"' testdata/err >/dev/null; then
        echo 'go build did not mention incorrect import:'
        cat testdata/err
        ok=false