Skip to content

Curate the Go tool directory on the Makefile PATH (#698) - #701

Draft
leynos wants to merge 2 commits into
mainfrom
issue-698-make-lint-fails-when-go-bin-is-absent-from-path-despite-actionlint-being-installed
Draft

Curate the Go tool directory on the Makefile PATH (#698)#701
leynos wants to merge 2 commits into
mainfrom
issue-698-make-lint-fails-when-go-bin-is-absent-from-path-despite-actionlint-being-installed

Conversation

@leynos

@leynos leynos commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

make lint failed with make: actionlint: No such file or directory
(exit 127) for any caller whose PATH lacked the Go tool directory, even
when actionlint was correctly installed at ~/go/bin/actionlint. The
Makefile curates its own PATH but omitted that directory, so resolution
depended entirely on the inherited PATH. CI was unaffected because it passes
an absolute ACTIONLINT= override.

Closes #698.

Changes

  • Makefile: add a GO_BIN variable resolving $GOBIN, else
    $GOPATH/bin, else $HOME/go/bin, and append it to the curated PATH after
    the existing three directories so current precedence is preserved. Resolve
    ACTIONLINT with command -v plus a fallback, mirroring CARGO, so a
    missing binary reports the path it looked in rather than a bare exit 127.
  • tests/workflow_contracts/makefile_tool_path_contract_test.py: five
    contract tests covering the three Go environment shapes, end-to-end
    resolution from $HOME/go/bin under a minimal caller PATH, and the
    diagnostic message. All five fail against the previous Makefile.
  • AGENTS.md: note the Go tool directory requirement beside the make lint inventory.
  • docs/developers-guide.md: record how the Makefile resolves actionlint
    and correct the local-install snippet so make github-actions-lint works as
    written.

Verification

  • make lint, make check-fmt, make typecheck, make test (2803 passed,
    3 skipped; 115 doctests), make test-workflow-contracts (321 passed) - all
    green.
  • make markdownlint, make nixie, make test-markdown-format - all green.
  • coderabbit review --agent --committed --base main: 0 findings.
  • Reproduction now exits 0:
    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:

  • Ensure Makefile lint workflows find Go-installed tools when the caller’s PATH omits the Go tool directory.
  • Provide a useful expected-path diagnostic when actionlint is unavailable.

Enhancements:

  • Centralize Go tool directory resolution across GOBIN, GOPATH, and the default home directory while preserving existing PATH precedence.
  • Add contract coverage for Go tool directory selection, actionlint discovery, and missing-tool diagnostics.

Documentation:

  • Document the curated Go tool PATH and actionlint resolution, including local installation and override guidance.

`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.
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The 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 resolution

flowchart 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
Loading

File-Level Changes

Change Details Files
Curate the Go tool directory in Makefile-managed PATH and improve actionlint resolution diagnostics.
  • Derive GO_BIN from GOBIN, GOPATH/bin, or HOME/go/bin, with an override available.
  • Append GO_BIN after the existing user tool directories to preserve precedence.
  • Resolve ACTIONLINT via command -v with a GO_BIN/actionlint fallback for actionable missing-tool errors.
Makefile
Add contract coverage for Go tool path selection and actionlint discovery.
  • Test the default, GOBIN, and GOPATH directory-resolution cases.
  • Verify actionlint is found from HOME/go/bin under a minimal caller PATH.
  • Verify missing actionlint errors identify the expected path.
tests/workflow_contracts/makefile_tool_path_contract_test.py
Document the curated Go tool path and local actionlint setup.
  • Record Go tool directory requirements and override behavior in contributor guidance.
  • Explain actionlint resolution and update the installation example to pass the locally installed binary explicitly.
AGENTS.md
docs/developers-guide.md

Assessment against linked issues

Issue Objective Addressed Explanation
#698 Ensure the Makefile's curated PATH includes the Go tool directory, using GOBIN when set, otherwise GOPATH/bin, otherwise HOME/go/bin.
#698 Make make lint and make github-actions-lint locate actionlint installed in the Go tool directory even when the caller's inherited PATH omits that directory.
#698 Improve documentation and diagnostics around the Go tool directory and actionlint installation and resolution.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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.

make lint fails when ~/go/bin is absent from PATH despite actionlint being installed

1 participant