From 952b343cb3d319b77076ef3acb60e29e04cd51fd Mon Sep 17 00:00:00 2001 From: Martin HS Date: Tue, 19 Dec 2023 08:55:04 +0100 Subject: [PATCH] build: make linter emit output (#28704) --- build/ci.go | 2 +- internal/build/util.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/build/ci.go b/build/ci.go index afe1c332b..c272d3f2b 100644 --- a/build/ci.go +++ b/build/ci.go @@ -366,7 +366,7 @@ func doLint(cmdline []string) { linter := downloadLinter(*cachedir) lflags := []string{"run", "--config", ".golangci.yml"} - build.MustRunCommand(linter, append(lflags, packages...)...) + build.MustRunCommandWithOutput(linter, append(lflags, packages...)...) fmt.Println("You have achieved perfection.") } diff --git a/internal/build/util.go b/internal/build/util.go index 5c77b236d..17928118a 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -68,6 +68,25 @@ func MustRunCommand(cmd string, args ...string) { MustRun(exec.Command(cmd, args...)) } +func MustRunCommandWithOutput(cmd string, args ...string) { + var done chan bool + // This is a little loop to generate some output, so CI does not tear down the + // process after 300 seconds. + go func() { + for i := 0; i < 15; i++ { + fmt.Printf("Waiting for command %q\n", cmd) + select { + case <-time.After(time.Minute): + break + case <-done: + return + } + } + }() + MustRun(exec.Command(cmd, args...)) + close(done) +} + var warnedAboutGit bool // RunGit runs a git subcommand and returns its output.