internal/hlog: remove error wrapping
All checks were successful
Test / Create distribution (push) Successful in 32s
Test / Sandbox (push) Successful in 2m29s
Test / Hakurei (push) Successful in 4m6s
Test / Hpkg (push) Successful in 4m45s
Test / Sandbox (race detector) (push) Successful in 4m48s
Test / Hakurei (race detector) (push) Successful in 6m4s
Test / Flake checks (push) Successful in 1m26s

This was a stopgap solution that lasted for way too long. This finally removes it and prepares internal/app for some major changes.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-09-12 06:46:12 +09:00
parent 6265aea73a
commit f876043844
12 changed files with 270 additions and 290 deletions

View File

@@ -12,6 +12,7 @@ import (
"hakurei.app/internal/sys"
)
// New returns the address of a newly initialised [App] struct.
func New(ctx context.Context, os sys.State) (*App, error) {
a := new(App)
a.sys = os
@@ -24,6 +25,7 @@ func New(ctx context.Context, os sys.State) (*App, error) {
return a, err
}
// MustNew calls [New] and panics if an error is returned.
func MustNew(ctx context.Context, os sys.State) *App {
a, err := New(ctx, os)
if err != nil {
@@ -32,6 +34,7 @@ func MustNew(ctx context.Context, os sys.State) *App {
return a
}
// An App keeps track of the hakurei container lifecycle.
type App struct {
outcome *Outcome
@@ -46,7 +49,7 @@ func (a *App) ID() state.ID { a.mu.RLock(); defer a.mu.RUnlock(); return a.id.un
func (a *App) String() string {
if a == nil {
return "(invalid app)"
return "<nil>"
}
a.mu.RLock()
@@ -54,12 +57,12 @@ func (a *App) String() string {
if a.outcome != nil {
if a.outcome.user.uid == nil {
return fmt.Sprintf("(sealed app %s with invalid uid)", a.id)
return "<invalid>"
}
return fmt.Sprintf("(sealed app %s as uid %s)", a.id, a.outcome.user.uid)
return fmt.Sprintf("sealed app %s as uid %s", a.id, a.outcome.user.uid)
}
return fmt.Sprintf("(unsealed app %s)", a.id)
return fmt.Sprintf("unsealed app %s", a.id)
}
// Seal determines the [Outcome] of [hst.Config].
@@ -69,7 +72,7 @@ func (a *App) Seal(config *hst.Config) (*Outcome, error) {
defer a.mu.Unlock()
if a.outcome != nil {
panic("app sealed twice")
panic("attempting to seal app twice")
}
seal := new(Outcome)