Skip to content
forked from golang/go

Commit

Permalink
Merge pull request #151 from golang/master
Browse files Browse the repository at this point in the history
cmd/go: eliminate empty '()' when passing -mod=readonly explicitly to…
  • Loading branch information
sthagen authored Feb 12, 2020
2 parents 438670a + 363bcd0 commit 5a4122c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cmd/go/internal/modload/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ func Import(path string) (m module.Version, dir string, err error) {
if !pathIsStd {
if cfg.BuildModReason == "" {
queryErr = fmt.Errorf("import lookup disabled by -mod=%s", cfg.BuildMod)
} else {
queryErr = fmt.Errorf("import lookup disabled by -mod=%s\n\t(%s)", cfg.BuildMod, cfg.BuildModReason)
}
queryErr = fmt.Errorf("import lookup disabled by -mod=%s\n\t(%s)", cfg.BuildMod, cfg.BuildModReason)
}
return module.Version{}, "", &ImportMissingError{Path: path, QueryErr: queryErr}
}
Expand Down
1 change: 1 addition & 0 deletions src/cmd/go/testdata/script/mod_readonly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go mod edit -fmt
cp go.mod go.mod.empty
! go list all
stderr '^can''t load package: x.go:2:8: cannot find module providing package rsc\.io/quote: import lookup disabled by -mod=readonly'
! stderr '\(\)' # If we don't have a reason for -mod=readonly, don't log an empty one.
cmp go.mod go.mod.empty

# -mod=readonly should be set implicitly if the go.mod file is read-only
Expand Down

0 comments on commit 5a4122c

Please sign in to comment.