summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-18 09:13:28 +0200
committerPaul Buetow <paul@buetow.org>2026-03-18 09:13:28 +0200
commit3f85aa438bffaad287a450898c44942634944c22 (patch)
tree1e5ec6303d45d5003cf548bb1df58b34038b7113 /cmd
parent1731c3723ced92a5dc8e54fb0caf4e33b2c7ba70 (diff)
refactor: pass flags.Config explicitly, remove flags.Get() from library code (task 429)
flags.Get() (global mutable singleton) was called inside library packages, coupling them to global state and making tests fragile (DIP violation). - internal.Run() now takes an explicit flags.Config; main.go calls flags.Get() once at the CLI boundary and passes it in. - tui.Run(), RunWithTraceStarter(), RunTestFlamesWithTraceStarter() removed; callers already used the WithConfig variants directly. - tui.NewModel() preserved for test ergonomics but now uses flags.NewFlags() (pure defaults) instead of flags.Get() (global state). - Tests updated to use NewModelWithConfig() with explicit config structs instead of flags.Set*() + NewModel(), eliminating all test-level global-state mutation. flags.Get() is now called only in cmd/ior/main.go, the correct boundary. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ior/main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/ior/main.go b/cmd/ior/main.go
index 2b852f0..8d93d28 100644
--- a/cmd/ior/main.go
+++ b/cmd/ior/main.go
@@ -23,8 +23,9 @@ func main() {
os.Exit(2)
}
- // Run the internal logic of the application
- if err := internal.Run(); err != nil {
+ // Run the internal logic of the application.
+ // flags.Get() is called here at the CLI boundary so internal code never reads the singleton.
+ if err := internal.Run(flags.Get()); err != nil {
fmt.Printf("Failed to run: %v\n", err)
os.Exit(2)
}