mirror of
https://github.com/golang/go
synced 2024-11-13 19:10:22 -07:00
cmd/go: adjust import comment error
Fixes #7453. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/127210043
This commit is contained in:
parent
9aa1e9afda
commit
3763a395b2
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user