tpagectl: configFromContext returns nil without error signal #538

Closed
opened 2026-08-05 06:10:58 +00:00 by the.auditor · 1 comment
Owner

configFromContext in cmd/tpagectl/main.go returns nil when the root command's Before hook hasn't run, with no way for callers to distinguish "no config" from "hook skipped". Future subcommands calling it directly risk nil-pointer dereference.

Suggested fix: return (*config.Config, bool) or an error alongside the value.

Ref: PR #537

`configFromContext` in `cmd/tpagectl/main.go` returns `nil` when the root command's Before hook hasn't run, with no way for callers to distinguish "no config" from "hook skipped". Future subcommands calling it directly risk nil-pointer dereference. Suggested fix: return `(*config.Config, bool)` or an error alongside the value. Ref: PR #537
Owner

Fixed in #634: configFromContext now returns (*config.Config, error) instead of a silent nil.

Fixed in #634: `configFromContext` now returns `(*config.Config, error)` instead of a silent `nil`.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd#538
No description provided.