dev/sg: rework output and add Buildkite log headers
Created by: bobheadxi
Four major changes:
- Rename
stdouttostd, so that it reads nicer:std.Outinstead ofstdout.Out - Wrap
output.Outputwithstd.Outputso 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.gointostd.Output, and rename a few to make them more purposeful:orangeLinef->WriteAlertf, and so on. This will help us alignsgoutput across the tool. Moving tostd.Outalso allowssgpackages outside ofmainto share formatting primitives. - Add aliases for
LineandLinefthat does not provide all arguments:output.Styled,output.Emoji, and friends. The pattern of omittingoutput.Styleor 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: