check / check (push) Canceled after 0s
cli.Entry() set time.Local to UTC and ended with memguard.Purge(), and TestEntryWipesBuffersAndReturnsExitCode ran it in the same process as the other tests. A timer left by an earlier test could read time.Local as it changed, which the race detector reported on some runs, and the purge could destroy a buffer still in use, the likeliest cause of a crash seen on another run. main() in cmd/secret now sets time.Local before it calls cli.Entry(); the test that runs the built binary with TZ=America/New_York still covers it. The Entry test runs cli.Entry() in a copy of the test binary started with SECRET_TEST_RUN_ENTRY set, which init picks up so that TestMain does not run there. Model: opus-5-5
19 lines
466 B
Go
19 lines
466 B
Go
// Package main is the entry point for the secret CLI application.
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
|
|
"sneak.berlin/go/secret/internal/cli"
|
|
)
|
|
|
|
func main() {
|
|
// Every time secret prints or writes is in UTC, whatever TZ or the
|
|
// system's time zone is set to. It is set here, before cli.Entry starts
|
|
// any goroutine that could read time.Local while it changes.
|
|
time.Local = time.UTC //nolint:gosmopolitan // this makes local time UTC
|
|
|
|
os.Exit(cli.Entry())
|
|
}
|