internal/app: unexport outcome, remove app struct
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m14s
Test / Hakurei (race detector) (push) Successful in 5m20s
Test / Hpkg (push) Successful in 41s
Test / Hakurei (push) Successful in 2m20s
Test / Sandbox (race detector) (push) Successful in 2m9s
Test / Flake checks (push) Successful in 1m30s

The App struct no longer does anything, and the outcome struct is entirely opaque.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-09-24 18:44:14 +09:00
parent b99c63337d
commit 1c4f593566
9 changed files with 59 additions and 149 deletions

View File

@@ -22,7 +22,7 @@ import (
// duration to wait for shim to exit, after container WaitDelay has elapsed.
const shimWaitTimeout = 5 * time.Second
// mainState holds persistent state bound to [Outcome.Main].
// mainState holds persistent state bound to outcome.main.
type mainState struct {
// done is whether beforeExit has been called already.
done bool
@@ -33,7 +33,7 @@ type mainState struct {
// Time is nil if no process was ever created.
Time *time.Time
seal *Outcome
seal *outcome
store state.Store
cancel context.CancelFunc
cmd *exec.Cmd
@@ -218,9 +218,8 @@ func (ms mainState) fatal(fallback string, ferr error) {
os.Exit(1)
}
// Main commits deferred system setup, runs the container, reverts changes to the system, and terminates the program.
// Main does not return.
func (seal *Outcome) Main() {
// main carries out outcome and terminates. main does not return.
func (seal *outcome) main() {
if !seal.f.CompareAndSwap(false, true) {
panic("outcome: attempted to run twice")
}