container: provide usage example
All checks were successful
Test / Create distribution (push) Successful in 39s
Test / Sandbox (push) Successful in 2m17s
Test / Hakurei (push) Successful in 3m15s
Test / Sandbox (race detector) (push) Successful in 4m12s
Test / Hpkg (push) Successful in 4m16s
Test / Hakurei (race detector) (push) Successful in 5m7s
Test / Flake checks (push) Successful in 1m29s

This requires cgo so unfortunately will not run in the playground.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-11-14 18:11:39 +09:00
parent b7406cc4c4
commit 299685775a
4 changed files with 47 additions and 3 deletions

View File

@@ -56,7 +56,7 @@ func NewAbs(pathname string) (*Absolute, error) {
// MustAbs calls [NewAbs] and panics on error.
func MustAbs(pathname string) *Absolute {
if a, err := NewAbs(pathname); err != nil {
panic(err.Error())
panic(err)
} else {
return a
}

View File

@@ -84,9 +84,9 @@ func TestNewAbs(t *testing.T) {
t.Parallel()
defer func() {
wantPanic := `path "etc" is not absolute`
wantPanic := &AbsoluteError{Pathname: "etc"}
if r := recover(); r != wantPanic {
if r := recover(); !reflect.DeepEqual(r, wantPanic) {
t.Errorf("MustAbs: panic = %v; want %v", r, wantPanic)
}
}()