Repository navigation
ci: catch Go code outside tool modules and close gaps in the Windows job, hook and docs - #8
Merged
Conversation
…job, hook and docs Find modules fails when a go.mod isn't at <tool>/go.mod or a .go file is outside every tool module, since the module jobs would skip that code. The pre-commit hook refuses a nested go.mod too, and picks the modules to check from deleted files as well, so a commit that only deletes Go files still gets built and linted. The Windows job runs with the latest stable Go, not the first module's, so a tool that needs a newer Go builds there. .gitleaks.toml goes: its allowlist was for storage keys in core's tests. The docs say which make targets take /<tool>, and that a recipe line can be cd <dir> && <cmd>.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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
Closes gaps in the repo tooling that the review of #2 found:
.gitleaks.tomlkept an allowlist this repo doesn't need.Type of Change
Changes Made
Find modules (
ci.yml) fails when:go.modisn't at<tool>/go.mod, either at the root or nested inside a tool.gofile is outside every tool moduleThe module and Windows jobs would skip that code and
CIwould still pass. It lists files withgit ls-files, so only tracked files count.Make on Windows uses the latest stable Go. It took
go-version-filefrom the first module, and setup-go setsGOTOOLCHAIN=local, so a tool needing a newer Go failed there.pre-commit:
.go,go.modandgo.sumfiles too, so deleting a file another one uses fails the build or lint step.go.modleft, is skipped.go.modorgo.sum, as CI does..gitleaks.tomlremoved. Its only change to gitleaks' default rules was an allowlist for storage keys in core's*_test.gofiles. That allowlist weakenedgeneric-api-keyin every test file here.Docs and Makefile help:
fmt,lint,license,license-check,tidy,build,testandvulntake/<tool>.cd <dir> && <command>..gofile is in a tool module.Testing
The repo has no test harness for its CI scripts and hooks, so I ran them by hand:
The Find modules script, taken from
ci.yml, in scratch repos:[]migrator/["migrator"]migrator/andseeder/["migrator","seeder"]stray.goscripts/gen.gomigrator/x/go.modgo.modpre-commit:
migrator/parser.gonow runs the Go checks, and they fail withundefined: Migration.migrator/x/go.modis refused.migrator/skips the Go checks.make checkpasses, and gitleaks with its default rules finds nothing.makeshows the new help text.CI on this PR runs the new Find modules step, and the Windows job with stable Go.
Checklist
Related Issues
Closes #6. Related to #2.
Screenshots/Demo
N/A
Additional Notes
None.