Skip to content

Commit 4d5f05a

Browse files
committed
Go: Adjust log messages depending on whether build scripts were found or not
1 parent 1b9e8ae commit 4d5f05a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,21 @@ func setGopath(root string) {
325325
func buildWithoutCustomCommands(modMode project.ModMode) (shouldInstallDependencies bool) {
326326
shouldInstallDependencies = false
327327
// try to run a build script
328-
scriptSucceeded, _ := autobuilder.Autobuild()
328+
scriptSucceeded, scriptsExecuted := autobuilder.Autobuild()
329+
scriptCount := len(scriptsExecuted)
329330

330331
// If there is no build script we could invoke successfully or there are still dependency errors;
331332
// we'll try to install dependencies ourselves in the normal Go way.
332333
if !scriptSucceeded {
333-
log.Println("Unable to find or execute a build script, continuing to install dependencies in the normal way.")
334+
if scriptCount > 0 {
335+
log.Printf("Unsuccessfully ran %d build scripts(s), continuing to install dependencies in the normal way.\n", scriptCount)
336+
} else {
337+
log.Println("Unable to find any build scripts, continuing to install dependencies in the normal way.")
338+
}
334339

335340
shouldInstallDependencies = true
336341
} else if toolchain.DepErrors("./...", modMode.ArgsForGoVersion(toolchain.GetEnvGoSemVer())...) {
337-
log.Println("Dependencies are still not resolving after execution of a build script, continuing to install dependencies in the normal way.")
342+
log.Printf("Dependencies are still not resolving after executing %d build script(s), continuing to install dependencies in the normal way.\n", scriptCount)
338343

339344
shouldInstallDependencies = true
340345
}

0 commit comments

Comments
 (0)