File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -237,6 +237,19 @@ func getDepMode() DependencyInstallerMode {
237237 return GoGetNoModules
238238}
239239
240+ func getModMode (depMode DependencyInstallerMode ) ModMode {
241+ if depMode == GoGetWithModules {
242+ // if a vendor/modules.txt file exists, we assume that there are vendored Go dependencies, and
243+ // skip the dependency installation step and run the extractor with `-mod=vendor`
244+ if util .FileExists ("vendor/modules.txt" ) {
245+ return ModVendor
246+ } else if util .DirExists ("vendor" ) {
247+ return ModMod
248+ }
249+ }
250+ return ModUnset
251+ }
252+
240253func main () {
241254 if len (os .Args ) > 1 {
242255 usage ()
@@ -264,7 +277,6 @@ func main() {
264277 // determine how to install dependencies and whether a GOPATH needs to be set up before
265278 // extraction
266279 depMode := getDepMode ()
267- modMode := ModUnset
268280 needGopath := true
269281 goDirectiveFound := false
270282 if _ , present := os .LookupEnv ("GO111MODULE" ); ! present {
@@ -290,15 +302,7 @@ func main() {
290302 }
291303 }
292304
293- if depMode == GoGetWithModules {
294- // if a vendor/modules.txt file exists, we assume that there are vendored Go dependencies, and
295- // skip the dependency installation step and run the extractor with `-mod=vendor`
296- if util .FileExists ("vendor/modules.txt" ) {
297- modMode = ModVendor
298- } else if util .DirExists ("vendor" ) {
299- modMode = ModMod
300- }
301- }
305+ modMode := getModMode (depMode )
302306
303307 if modMode == ModVendor {
304308 // fix go vendor issues with go versions >= 1.14 when no go version is specified in the go.mod
You can’t perform that action at this time.
0 commit comments