Skip to content

Commit bbc359e

Browse files
committed
Go: Improve messages in buildWithoutCustomCommands
1 parent 5eaaf02 commit bbc359e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -320,25 +320,25 @@ func setGopath(root string) {
320320
log.Printf("GOPATH set to %s.\n", newGopath)
321321
}
322322

323-
// Try to build the project without custom commands. If that fails, return a boolean indicating
324-
// that we should install dependencies ourselves.
325-
func buildWithoutCustomCommands(modMode project.ModMode) bool {
326-
shouldInstallDependencies := false
327-
// try to build the project
328-
buildSucceeded := autobuilder.Autobuild()
329-
330-
// Build failed or there are still dependency errors; we'll try to install dependencies
331-
// ourselves
332-
if !buildSucceeded {
333-
log.Println("Build failed, continuing to install dependencies.")
323+
// Try to build the project with a build script. If that fails, return a boolean indicating
324+
// that we should install dependencies in the normal way.
325+
func buildWithoutCustomCommands(modMode project.ModMode) (shouldInstallDependencies bool) {
326+
shouldInstallDependencies = false
327+
// try to run a build script
328+
scriptSucceeded := autobuilder.Autobuild()
329+
330+
// If there is no build script we could invoke successfully or there are still dependency errors;
331+
// we'll try to install dependencies ourselves in the normal Go way.
332+
if !scriptSucceeded {
333+
log.Println("Unable to find or execute a build script, continuing to install dependencies in the normal way.")
334334

335335
shouldInstallDependencies = true
336336
} else if toolchain.DepErrors("./...", modMode.ArgsForGoVersion(toolchain.GetEnvGoSemVer())...) {
337-
log.Println("Dependencies are still not resolving after the build, continuing to install dependencies.")
337+
log.Println("Dependencies are still not resolving after execution of a build script, continuing to install dependencies in the normal way.")
338338

339339
shouldInstallDependencies = true
340340
}
341-
return shouldInstallDependencies
341+
return
342342
}
343343

344344
// Build the project with custom commands.

0 commit comments

Comments
 (0)