Skip to content

Commit 16a2107

Browse files
committed
Go autobuilder: don't attempt a go mod tidy when there's a vendor directory present
This is likely to spuriously remove dependencies leading to a later build failure due to missing requirements.
1 parent cdf343c commit 16a2107

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

go/extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func main() {
291291
}
292292

293293
// Go 1.16 and later won't automatically attempt to update go.mod / go.sum during package loading, so try to update them here:
294-
if depMode == GoGetWithModules && semver.Compare(getEnvGoSemVer(), "1.16") >= 0 {
294+
if modMode != ModVendor && depMode == GoGetWithModules && semver.Compare(getEnvGoSemVer(), "1.16") >= 0 {
295295
// stat go.mod and go.sum
296296
beforeGoModFileInfo, beforeGoModErr := os.Stat("go.mod")
297297
if beforeGoModErr != nil {

0 commit comments

Comments
 (0)