Skip to content

fix: check error received from adhoc error channel - #729

Merged
adgubrud merged 1 commit into
intel:mainfrom
adgubrud:fix_errcheck_adhoc_error_channel
Oct 16, 2026
Merged

adgubrud merged 1 commit into
intel:mainfrom
adgubrud:fix_errcheck_adhoc_error_channel

Conversation

@adgubrud

Copy link
Copy Markdown
Contributor

Problem
make check_lint fails on main and on every open PR, with no code change required to trigger it:

internal/workflow/workflow.go:222:4: Error return value is not checked (errcheck)
<-adhocErrorChannel
^
1 issues:

  • errcheck: 1
    make: *** [Makefile:148: check_lint] Error 1
    The check_lint target installs the linter unpinned:

go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
golangci-lint 2.15.0 ships an errcheck that now reports a bare channel receive whose value is an error. The code it flags has been unchanged since #599, so this is an upstream linter change rather than a regression in the tree.

Fix
The receive in question is a completion barrier, and AdhocFunc already reports its own errors — hence the original dropped value. This consumes the value and logs it at debug level, mirroring how the perf error channel is handled in cmd/metrics/metrics.go:

// wait for all adhoc actions to complete, errors were reported by the AdhocFunc
for range myTargets {
if adhocErr := <-adhocErrorChannel; adhocErr != nil {
slog.Debug("adhoc function error", slog.String("error", adhocErr.Error()))
}
}
Behavior is unchanged: the loop still blocks until every adhoc action has reported, and errors remain surfaced to the user by AdhocFunc.

_ = <-adhocErrorChannel was considered and rejected — it satisfies errcheck but trips staticcheck's S1005 (unnecessary blank identifier), which runs earlier in make check.

Validation
Run against golangci-lint 2.15.0, the version that surfaced the failure:

golangci-lint run → 0 issues
staticcheck ./internal/workflow/... → clean
go build ./..., gofmt -l, go vet → clean
go test ./internal/workflow/... → pass
Follow-up worth considering (not in this PR)
check_lint, check_static, check_vuln, and check_sec all install their tools with @latest, so any upstream release can turn CI red with no change to this repo — exactly what happened here. Pinning those versions in the Makefile would make such failures land deliberately, on a bump commit. Happy to open a separate PR if maintainers want that.

golangci-lint is installed unpinned (@latest) by the check_lint make
target, and errcheck in golangci-lint 2.15.0 now reports a bare channel
receive whose value is an error. This fails CI on main and on every open
PR without any code change:

  internal/workflow/workflow.go:222:4: Error return value is not
  checked (errcheck)

The receive is a completion barrier and AdhocFunc already reports its
own errors, so consume the value and log it at debug level, matching the
handling of the perf error channel in cmd/metrics. Using the blank
identifier instead would trip staticcheck's S1005, which runs earlier in
make check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adgubrud
adgubrud requested a review from harp-intel as a code owner October 16, 2026 17:03
@adgubrud
adgubrud merged commit 63f8fd7 into intel:main Oct 16, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant