fix quickstyle: prefer repo tools and cache goimports #116
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.
What
Updated
quickstyleto be more reliable in StackRox repos by resolving Go tooling via repo-managed binaries when available and by ensuring required tools exist.Why
Running
quickstyleagainststackroxrepo could fail for non-style reasons.Before this change
roxvetfromGOPATH/bin:quickstylewould use$(go env GOPATH)/bin/roxvetif present. If it was built with an older Go version than the target repo’s toolchain, it could error with “package requires newer Go version …” and/or panic (e.g.pkgbits unsupported version: 2).goimports:quickstylecalledgoimportsdirectly without ensuring it exists, so environments withoutgoimportsonPATHfailed withgoimports: command not found.stackroxmanage tools under.gotools/bin(viamake which-*), butquickstyledidn’t prefer those canonical binaries, so results depended on whatever was installed globally.This change makes
quickstyleprefer repo toolchain wiring (viamake which-*) and provides a workflow-managed fallback forgoimports.Changes
make which-<tool>when available (e.g. gotools-basedroxvet,golangci-lint).GOPATH/bin/roxvet(Go major/minor mismatch) and rebuild it when possible.goimportsis available by installing it into a workflow cache (pinned to the repo’sgolang.org/x/toolsversion when available) and reusing it.How I validated my change
stackroxby running:cd ../stackrox && ../workflow/bin/quickstylegoimports: command not foundroxvet(and uses/rebuilds a compatibleroxvet)Example run after the changes:
AI / human attribution
make which-*+ fallbacks),goimportscaching/installation behavior, and helper-function documentation.