-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: write changes to go.mod and go.sum after loading the command-…
…line-arguments package This entrypoint was missed in CL 349600, and the behavior happened not to be covered by existing tests. Fixes golang#52331. Change-Id: Iccf12e8e633215abe4bfa1c3ca2fe3a8391b5ba5 Reviewed-on: https://go-review.googlesource.com/c/go/+/401536 Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Regression test for https://go.dev/issue/52331: 'go run -mod=mod' | ||
# failed to write go.mod and go.sum with the resolved dependencies. | ||
|
||
[short] skip | ||
|
||
! go run main.go | ||
# stderr '^main\.go:6:2: no required module provides package example\.com/version; to add it:\n\tgo get example\.com/version\n\z' | ||
|
||
go run -mod=mod main.go | ||
cmp go.mod go.mod.want | ||
grep -count=1 '^example\.com/version v1.1.0 h1:' go.sum | ||
grep -count=1 '^example\.com/version v1.1.0/go.mod h1:' go.sum | ||
|
||
-- go.mod -- | ||
module example | ||
|
||
go 1.17 | ||
-- go.mod.want -- | ||
module example | ||
|
||
go 1.17 | ||
|
||
require example.com/version v1.1.0 // indirect | ||
-- main.go -- | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"example.com/version" | ||
) | ||
|
||
func main() { | ||
fmt.Println(version.V) | ||
} |