check / check (push) Successful in 1m40s
`cmd/simplexcalc/` now holds only `main.go`, whose body is one call, `os.Exit(cli.Main(version))`, as the Go style guide requires. The command tree and the `run` and `version` commands moved unchanged into `internal/cli`, with tests for `version` and for an unknown command. Output streams, exit statuses and the `-X main.version` build flag are as before. Disclosure: the comment in `execute` saying cobra has already printed the error is false, since the root command silences cobra's errors; it moved unchanged and is left for a follow-up. Model: opus-5-5
19 lines
485 B
Go
19 lines
485 B
Go
// Command simplexcalc is a SimpleX Chat bot that answers arithmetic.
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"sneak.berlin/go/simplexcalc/internal/cli"
|
|
)
|
|
|
|
// version is injected at build time with -ldflags "-X main.version=...".
|
|
// The Dockerfile passes VERSION; a `go build` without it says "dev",
|
|
// which is exactly what a locally built binary is. It is a package
|
|
// variable because the linker has no other way to reach it.
|
|
var version = "dev"
|
|
|
|
func main() {
|
|
os.Exit(cli.Main(version))
|
|
}
|