-
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: display helpful error when module cache can't be created
Previously when the module cache specified by GOMODCACHE could not be created an unhelpful message would be printed multiple times. This happened because we were fetching several things in parallel then failing to write them because we can't create the module cache. We now check if the module cache can be created before fetching. If not, the following message is printed: go: could not create module cache Fixes #45113 Change-Id: Ic9cec787411335edc7f4d0614fde7eaa8a957fb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/304571 Trust: Julie Qiu <[email protected]> Run-TryBot: Julie Qiu <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 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 |
---|---|---|
|
@@ -47,6 +47,11 @@ env GOMODCACHE=$WORK/modcache | |
go mod download rsc.io/[email protected] | ||
exists $WORK/modcache/cache/download/rsc.io/quote/@v/v1.0.0.info | ||
|
||
# Test error when cannot create GOMODCACHE directory | ||
env GOMODCACHE=$WORK/modcachefile | ||
! go install example.com/cmd/[email protected] | ||
stderr 'go: could not create module cache' | ||
|
||
# Test that the following work even with GO111MODULE=off | ||
env GO111MODULE=off | ||
|
||
|
@@ -58,3 +63,5 @@ go clean -modcache | |
|
||
-- go.mod -- | ||
module m | ||
|
||
-- $WORK/modcachefile -- |