dev/sg/check.Runner: check-and-fix framework and experimental 'sg setupv2'
Created by: bobheadxi
The main interesting parts to review are in runner.go
. Arguably this doesn't need too extensive of a review, since the aim is to get a sg setupv2
and the check.Runner
framework out so that we can simultaneously:
- Bring
sg setupv2
back to parity withsg setup
(notably migrate the Ubuntu setup), and cut over entirely - Rewrite
sg lint
to usecheck.Runner
Goals:
- Auto-fix-oriented
sg setup
- removing support for manual fixing for the most part - Auto-fix support for
sg lint
(e.g. https://github.com/sourcegraph/sourcegraph/pull/36516) - Shared infrastructure for "check lots of things and try to fix them" (
sg lint
,sg setup
), so that e.g. we can getsg lint -interactive
andsg setup -fix
and a consistent experience across both + reduced engineering effort to maintain them, and improved packaging ofsg setup
code - Better control over output, so that different scenarios can handle them differently
- Automated testing in GitHub Actions for MacOS and Ubuntu (terms and conditions apply, see below) (only MacOS checks have been migrated so far)
Related: https://github.com/sourcegraph/sourcegraph/issues/36512 , https://github.com/sourcegraph/sourcegraph/issues/36379
Closes https://github.com/sourcegraph/sourcegraph/issues/35805
A lot of copy-paste for now of the existing sg setup
code, the goal is to eventually consoldiate and remove the existing sg setup
implementation
Test plan
Experimental new implementation does not touch existing code, and is exported as sg setupv2
which is a hidden command:
go run ./dev/sg setupv2
go run ./dev/sg setupv2 -check
go run ./dev/sg setupv2 -fix
Automated tests now run over (a subset of) the new dependencies implementation:
- OSS-only (non-teammates)
- Docker excluded (setup is wonky on GitHub agents)
Example build: https://github.com/sourcegraph/sourcegraph/runs/6802415622?check_suite_focus=true