Restore config loading, keep exported Version, keep cgo off

Bring back the in-progress viper and go-homedir configuration loading
from the original root command as a persistent pre-run on the root
command, with a --config flag and a config line in sutil info. Restore
the exported main.Version with a nolint directive instead of renaming
it. Export CGO_ENABLED=0 from the Makefile, drop -race from make test,
and remove the C toolchain from the Docker builder stage.
This commit is contained in:
2026-10-31 10:11:47 -07:00
parent f53b6aad42
commit 4d45aa4ca3
9 changed files with 243 additions and 25 deletions
+6 -4
View File
@@ -8,12 +8,14 @@ import (
"sneak.berlin/go/x/internal/cli"
)
// version is the build version. The Makefile and Dockerfile set it at link
// time with -ldflags "-X main.version=...".
var version = "dev"
// Version is the build version. The Makefile and Dockerfile set it at link
// time with -ldflags "-X main.Version=...".
//
//nolint:gochecknoglobals // set by the linker; there is no other way
var Version = "dev"
func main() {
err := cli.New(cli.Params{Version: version}).Execute()
err := cli.New(cli.Params{Version: Version, ConfigDir: ""}).Execute()
if err != nil {
os.Exit(1)
}