Skip to content

dev/sg: rework output and add Buildkite log headers

Administrator requested to merge sg-output-rework into main

Created by: bobheadxi

Four major changes:

  • Rename stdout to std, so that it reads nicer: std.Out instead of stdout.Out
  • Wrap output.Output with std.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 into std.Output, and rename a few to make them more purposeful: orangeLinef -> WriteAlertf, and so on. This will help us align sg output across the tool. Moving to std.Out also allows sg packages outside of main to share formatting primitives.
  • Add aliases for Line and Linef that does not provide all arguments: output.Styled, output.Emoji, and friends. The pattern of omitting output.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 😬 but the vast majority of this is renaming

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:

Screenshot 2022-05-10 at 3 16 16 PM

Merge request reports

Loading