dev/sg: rework output and add Buildkite log headers
Created by: bobheadxi
Four major changes:
- Rename
stdout
tostd
, so that it reads nicer:std.Out
instead ofstdout.Out
- Wrap
output.Output
withstd.Output
so that we can build wrappers on top. This wrapper is also used to generate Buildkite log output anchors (https://buildkite.com/docs/pipelines/managing-log-output), which helps us manage CI output. - Migrating
printing.go
intostd.Output
, and rename a few to make them more purposeful:orangeLinef
->WriteAlertf
, and so on. This will help us alignsg
output across the tool. Moving tostd.Out
also allowssg
packages outside ofmain
to share formatting primitives. - Add aliases for
Line
andLinef
that does not provide all arguments:output.Styled
,output.Emoji
, and friends. The pattern of omittingoutput.Style
or emoji is so common that I think it is worth introducing special aliases for them to avoid constantly having to enter blank arguments.
Minor changes:
- Add an error handler that writes pretty failure notice instead
Sorry for the big PR! I got a bit carried away here
Test plan
go run ./dev/sg
for a variety of commands still work
Set BUILDKITE=true
and try e.g. go run ./dev/sg lint
, or just check it out in CI: