-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: ignore unknown directives in dependency go.mod files
This will help with forward compatibility when we add additional directives that only matter for the main module (or that can be safely ignored otherwise). Change-Id: Ida1e186fb2669b128aeb5a9a1187e2535b72b763 Reviewed-on: https://go-review.googlesource.com/125936 Reviewed-by: Bryan C. Mills <[email protected]>
- Loading branch information
Showing
5 changed files
with
88 additions
and
10 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
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,11 @@ | ||
rsc.io/badmod v1.0.0 | ||
written by hand | ||
|
||
-- .mod -- | ||
module rsc.io/badmod | ||
hello world | ||
-- .info -- | ||
{"Version":"v1.0.0"} | ||
-- x.go -- | ||
package x | ||
|
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,26 @@ | ||
# Unknown lines should be ignored in dependency go.mod files. | ||
env GO111MODULE=on | ||
go list -m all | ||
|
||
# ... and in replaced dependency go.mod files. | ||
cp go.mod go.mod.usesub | ||
go list -m all | ||
|
||
# ... but not in the main module. | ||
cp go.mod.bad go.mod | ||
! go list -m all | ||
stderr 'unknown directive: hello' | ||
|
||
-- go.mod -- | ||
module m | ||
require rsc.io/badmod v1.0.0 | ||
-- go.mod.bad -- | ||
module m | ||
hello world | ||
-- go.mod.usesub -- | ||
module m | ||
require rsc.io/badmod v1.0.0 | ||
replace rsc.io/badmod v1.0.0 => ./sub | ||
-- sub/go.mod -- | ||
module sub | ||
hello world |