Curate the Go tool directory on the Makefile PATH (#698) - #701
Draft
leynos wants to merge 2 commits into
Draft
Conversation
`go install` writes to `$GOBIN`, else `$GOPATH/bin`, else `$HOME/go/bin`, and none of those directories was on the PATH the Makefile builds for its recipes. `make lint` therefore failed at `actionlint` with exit 127 and `No such file or directory` for any caller whose own PATH omitted the directory, which reads as "the tool is not installed" rather than "the tool is installed but not on this PATH". Add a `GO_BIN` variable that resolves the directory from `$GOBIN`, `$GOPATH`, or `$HOME/go/bin` in that order, append it to the curated PATH after the existing three directories so current precedence is preserved, and resolve `ACTIONLINT` with `command -v` plus a fallback, mirroring `CARGO`. A missing binary now reports the path it looked in. CI is unaffected: it passes an absolute `ACTIONLINT=` override, which still wins over the Makefile default. Add contract tests covering the three Go environment shapes, the end-to-end resolution from `$HOME/go/bin` under a minimal caller PATH, and the diagnostic path in the failure message. All five fail against the previous Makefile.
Contributors who follow the developers' guide install `actionlint` into the current directory and then run `make github-actions-lint`, which previously failed with exit 127 because neither the current directory nor the Go tool directory was on the Makefile's PATH. The snippet now hands the binary to the Makefile through `ACTIONLINT`, exactly as CI does, and the surrounding prose records where the Makefile looks: the curated PATH, which includes `$GOBIN`, `$GOPATH/bin`, or `$HOME/go/bin`, with `GO_BIN` and `ACTIONLINT` as overrides. Note the same requirement beside the `make lint` inventory in `AGENTS.md`, so an agent working from a minimal PATH installs into a directory the Makefile curates rather than misreading the failure as a missing tool.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Contributor
Reviewer's GuideThe PR updates the Makefile to derive and export the Go tool directory, append it to the recipe PATH without changing existing precedence, and resolve actionlint with a useful fallback diagnostic. New workflow contract tests cover all supported Go environment configurations and end-to-end behavior, while contributor documentation explains the setup and overrides. Flow diagram for Makefile Go tool path resolutionflowchart TD
A[Makefile starts] --> B{GOBIN set?}
B -->|Yes| C[GO_BIN = GOBIN]
B -->|No| D{GOPATH set?}
D -->|Yes| E[GO_BIN = GOPATH/bin]
D -->|No| F[GO_BIN = HOME/go/bin]
C --> G[Append GO_BIN to curated PATH]
E --> G
F --> G
G --> H[Resolve ACTIONLINT with command -v]
H -->|Found| I[Use resolved executable]
H -->|Missing| J[Fallback to GO_BIN/actionlint]
I --> K[Run Makefile lint recipe]
J --> K
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
make lintfailed withmake: actionlint: No such file or directory(exit 127) for any caller whose
PATHlacked the Go tool directory, evenwhen
actionlintwas correctly installed at~/go/bin/actionlint. TheMakefile curates its own
PATHbut omitted that directory, so resolutiondepended entirely on the inherited
PATH. CI was unaffected because it passesan absolute
ACTIONLINT=override.Closes #698.
Changes
Makefile: add aGO_BINvariable resolving$GOBIN, else$GOPATH/bin, else$HOME/go/bin, and append it to the curatedPATHafterthe existing three directories so current precedence is preserved. Resolve
ACTIONLINTwithcommand -vplus a fallback, mirroringCARGO, so amissing binary reports the path it looked in rather than a bare exit 127.
tests/workflow_contracts/makefile_tool_path_contract_test.py: fivecontract tests covering the three Go environment shapes, end-to-end
resolution from
$HOME/go/binunder a minimal callerPATH, and thediagnostic message. All five fail against the previous Makefile.
AGENTS.md: note the Go tool directory requirement beside themake lintinventory.docs/developers-guide.md: record how the Makefile resolvesactionlintand correct the local-install snippet so
make github-actions-lintworks aswritten.
Verification
make lint,make check-fmt,make typecheck,make test(2803 passed,3 skipped; 115 doctests),
make test-workflow-contracts(321 passed) - allgreen.
make markdownlint,make nixie,make test-markdown-format- all green.coderabbit review --agent --committed --base main: 0 findings.env -u PATH PATH=/usr/bin:/usr/local/bin:$HOME/.cargo/bin make github-actions-lint.References
🤖 Generated with Claude Code
Summary by Sourcery
Make Go-installed workflow tools discoverable through the Makefile’s curated PATH and improve actionlint failure diagnostics.
Bug Fixes:
Enhancements:
Documentation: