Skip to content

Commit

Permalink
cmd/go: fix error message when missing import
Browse files Browse the repository at this point in the history
Fixes golang#48907

Change-Id: I504f846fc2ea655ba00aedb30f90847f938c347c
Reviewed-on: https://go-review.googlesource.com/c/go/+/360615
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Trust: Emmanuel Odeke <[email protected]>
  • Loading branch information
zhouguangyuan0718 authored and odeke-em committed Jan 30, 2022
1 parent 1226547 commit a5c0b19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cmd/go/testdata/script/mod_go_version_missing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cmp go.mod go.mod.orig

! go list -mod=vendor all
! stderr '^go: inconsistent vendoring'
stderr 'cannot find package "\." in:\n\t.*[/\\]vendor[/\\]example.com[/\\]badedit$'
stderr 'cannot find package "vendor/example.com/badedit" in:\n\t.*[/\\]vendor[/\\]example.com[/\\]badedit$'

# When we set -mod=mod, the go version should be updated immediately,
# to the current version, converting the requirements from eager to lazy.
Expand Down
2 changes: 1 addition & 1 deletion src/go/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ Found:
}

// package was not found
return p, fmt.Errorf("cannot find package %q in:\n\t%s", path, p.Dir)
return p, fmt.Errorf("cannot find package %q in:\n\t%s", p.ImportPath, p.Dir)
}

if mode&FindOnly != 0 {
Expand Down

0 comments on commit a5c0b19

Please sign in to comment.