forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: show an error when a package in a module conflicts with one i…
…n std Fixes golang#35270 Change-Id: I5d2a04359702be6dc04affb867540091b926bc23 Reviewed-on: https://go-review.googlesource.com/c/go/+/434095 Run-TryBot: xie cui <523516579@qq.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
- Loading branch information
1 parent
c05bf1e
commit 21b8e81
Showing
5 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
cd a | ||
! go build | ||
stderr '^ambiguous import: found package image in multiple modules:\s+image\s+.+\s.+image.+\s$' | ||
|
||
|
||
cd ../b | ||
! go build -mod=vendor | ||
stderr '^main.go:4:5: ambiguous import: found package image in multiple directories:\s+.+image\s+.+image\s+$' | ||
|
||
cd ../c | ||
! go build -mod=vendor | ||
stderr 'main.go:4:5: package p is not in GOROOT' | ||
|
||
-- a/go.mod -- | ||
module image | ||
|
||
-- a/main.go -- | ||
package main | ||
|
||
func main() { | ||
println("hello world!") | ||
} | ||
|
||
-- b/go.mod -- | ||
module test | ||
|
||
-- b/vendor/image/b.go -- | ||
package image | ||
func Add(a, b int) int { | ||
return a + b | ||
} | ||
|
||
-- b/main.go -- | ||
package main | ||
|
||
import ( | ||
"image" | ||
) | ||
|
||
func main() { | ||
println(image.Add(1,1)) | ||
} | ||
|
||
-- c/go.mod -- | ||
module test | ||
|
||
-- c/main.go -- | ||
package main | ||
|
||
import ( | ||
"p" | ||
) | ||
|
||
func main() { | ||
println(p.Add(1,1)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters