@@ -454,6 +454,25 @@ func moveToTemporaryGopath(srcdir string, importpath string) {
454
454
log .Printf ("GOPATH set to %s.\n " , newGopath )
455
455
}
456
456
457
+ func buildWithoutCustomCommands (modMode ModMode ) bool {
458
+ shouldInstallDependencies := false
459
+ // try to build the project
460
+ buildSucceeded := autobuilder .Autobuild ()
461
+
462
+ // Build failed or there are still dependency errors; we'll try to install dependencies
463
+ // ourselves
464
+ if ! buildSucceeded {
465
+ log .Println ("Build failed, continuing to install dependencies." )
466
+
467
+ shouldInstallDependencies = true
468
+ } else if util .DepErrors ("./..." , modMode .argsForGoVersion (getEnvGoSemVer ())... ) {
469
+ log .Println ("Dependencies are still not resolving after the build, continuing to install dependencies." )
470
+
471
+ shouldInstallDependencies = true
472
+ }
473
+ return shouldInstallDependencies
474
+ }
475
+
457
476
func main () {
458
477
if len (os .Args ) > 1 {
459
478
usage ()
@@ -511,20 +530,7 @@ func main() {
511
530
inst := util .Getenv ("CODEQL_EXTRACTOR_GO_BUILD_COMMAND" , "LGTM_INDEX_BUILD_COMMAND" )
512
531
shouldInstallDependencies := false
513
532
if inst == "" {
514
- // try to build the project
515
- buildSucceeded := autobuilder .Autobuild ()
516
-
517
- // Build failed or there are still dependency errors; we'll try to install dependencies
518
- // ourselves
519
- if ! buildSucceeded {
520
- log .Println ("Build failed, continuing to install dependencies." )
521
-
522
- shouldInstallDependencies = true
523
- } else if util .DepErrors ("./..." , modMode .argsForGoVersion (getEnvGoSemVer ())... ) {
524
- log .Println ("Dependencies are still not resolving after the build, continuing to install dependencies." )
525
-
526
- shouldInstallDependencies = true
527
- }
533
+ shouldInstallDependencies = buildWithoutCustomCommands (modMode )
528
534
} else {
529
535
// write custom build commands into a script, then run it
530
536
var (
0 commit comments