refactor: replace mutable global maps, log functions, and embedded request/response state #7
Labels
No labels
nagonag
nagonag/ignore
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
heiko/mailseal#7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Several mutable package globals and embedded fields complicate reasoning and testing:
main.go:TSAs map[string]boolcombines configuration, enablement, and iteration policy in a mutable/nondeterministic map.main.go:verbosefanddebugfare mutable global functions changed by command execution.main.go:timestampembeds both*tspclient.Requestand*tspclient.Response, promoting methods and creating ambiguity (Validateis already called through an explicit embedded field to avoid it).internal/rfc822/message.go: exported mutableFieldSetcan be changed by any importer and is unsafe under concurrent access.internal/rfc822/parser.go: mutable package-global debug state.main.go:initperforms process-global logging setup, making command construction less isolated.Checklist: #3 (avoid unnecessary
init), #10 (embedding ambiguity), and #58 (mutable shared state/races).Proposed fix
[]tsaConfig{Endpoint, Enabled}and helper functions for enabled endpoints.timestampand use keyed literals.main/root construction rather thaninit.Acceptance criteria
timestamphas explicit request and response fields.Reviewed against
948b7a9onmaster(Go 1.26.2).