fix(build): detect gotestsum and golangci-lint by running them

What does this MR do and why?

On a checkout where bin/ has not been populated yet, make test fails instead of building the tool it needs.

Makefile:4 prepends bin/ to PATH, so which gotestsum normally finds the copy make bootstrap left there and everything works. When bin/ is empty it instead finds a version manager's shim. Those shims exist for every tool the manager knows about, whether or not a version is configured for the current directory, so the name resolves but does not run:

$ which gotestsum
/Users/…/.local/share/mise/shims/gotestsum
$ gotestsum --version
mise ERROR No version is set for shim: gotestsum

HASGOTESTSUM is then set, which does two things at once: GOTEST points at the bare name, and the bin/gotestsum target becomes @echo "Skip this". So the fallback that would have downloaded a working copy never runs, and the build cannot self-heal:

mise ERROR No version is set for shim: gotestsum
make[1]: *** [test] Error 1
make: *** [test-changed] Error 2

That is the state a fresh clone is in before bin/ is populated, which makes it an onboarding papercut rather than something an existing checkout hits.

What changed

Probe by running the tool rather than by looking up its name, so a name that cannot execute falls through to the bin/ fallback. Applied to both probes, since HASGOCILINT has the identical shape and the identical failure mode.

Verification

With bin/gotestsum removed to reproduce the empty-bin/ state:

make -p | grep -E '^(HASGOTESTSUM|GOTEST) '
# before: HASGOTESTSUM := /…/shims/gotestsum   GOTEST = gotestsum        -> fails
# after:  HASGOTESTSUM :=                      GOTEST = bin/gotestsum    -> builds and runs

HASGOCILINT still resolves to the version manager's golangci-lint, which does run, so linting keeps using it rather than downloading a second copy.

lefthook run pre-push passes.

Merge request reports

Loading
Loading