Skip to content

Commit

Permalink
build: make linter emit output (#28704)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Dec 19, 2023
1 parent cd58897 commit 952b343
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}

Expand Down
19 changes: 19 additions & 0 deletions internal/build/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 952b343

Please sign in to comment.