Files
simplexcalc/cmd/simplexcalc/main.go
T
clawbot 09a5caa8ab
check / check (push) Successful in 1m40s
Move the command tree into internal/cli (closes #8)
`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
2026-09-29 01:51:34 +02:00

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))
}