fix(i18n): keep default state snapshot explicit
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 13:38:04 +00:00
parent 56b6db8a8d
commit fdb151a0af
2 changed files with 9 additions and 2 deletions

View file

@ -180,9 +180,10 @@ func CurrentDebug() bool {
// State returns a copy-safe snapshot of the default service configuration.
func State() ServiceState {
return defaultServiceValue(defaultServiceStateSnapshot(), func(svc *Service) ServiceState {
if svc := Default(); svc != nil {
return svc.State()
})
}
return defaultServiceStateSnapshot()
}
// CurrentState is a more explicit alias for State.

View file

@ -261,6 +261,12 @@ func TestCurrentState_Good(t *testing.T) {
assert.NotNil(t, CurrentState().Handlers[0])
}
func TestState_Good_WithoutDefaultService(t *testing.T) {
var svc *Service
state := svc.State()
assert.Equal(t, defaultServiceStateSnapshot(), state)
}
// --- SetMode / CurrentMode ---
func TestSetMode_Good(t *testing.T) {