From 4a53bfdebf57922e2835c05c40a942805dfec7f2 Mon Sep 17 00:00:00 2001 From: Sauyon Lee Date: Sat, 3 Oct 2020 13:40:02 -0700 Subject: [PATCH] autobuilder: Only set mod mode when go.mod exists --- extractor/cli/go-autobuilder/go-autobuilder.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/extractor/cli/go-autobuilder/go-autobuilder.go b/extractor/cli/go-autobuilder/go-autobuilder.go index 8a2b4a67f6a..38acf12dfb9 100644 --- a/extractor/cli/go-autobuilder/go-autobuilder.go +++ b/extractor/cli/go-autobuilder/go-autobuilder.go @@ -293,12 +293,14 @@ func main() { log.Println("Found glide.yaml, enabling go modules") } - // if a vendor/modules.txt file exists, we assume that there are vendored Go dependencies, and - // skip the dependency installation step and run the extractor with `-mod=vendor` - if util.FileExists("vendor/modules.txt") { - modMode = ModVendor - } else if util.DirExists("vendor") { - modMode = ModMod + if depMode == GoGetWithModules { + // if a vendor/modules.txt file exists, we assume that there are vendored Go dependencies, and + // skip the dependency installation step and run the extractor with `-mod=vendor` + if util.FileExists("vendor/modules.txt") { + modMode = ModVendor + } else if util.DirExists("vendor") { + modMode = ModMod + } } if modMode == ModVendor {