use -mod=readonly rather than -mod= for go list

The empty string is not a valid value for the -mod flag, and it fails when using a workspace too:

    go: -mod may only be set to readonly or vendor when in workspace mode, but it is set to ""
This commit is contained in:
dydysy
2024-08-27 16:13:19 +08:00
committed by GitHub
parent c41f026cd6
commit a99fbcbe43

View File

@@ -231,7 +231,7 @@ func appendListedPackages(packages []string, mainBuild bool) error {
// However, when loading standard library packages,
// using those flags would likely result in an error,
// as the standard library uses its own Go module and vendoring.
args = append(args, "-mod=", "-modfile=")
args = append(args, "-mod=readonly", "-modfile=")
}
args = append(args, packages...)