From fc9d57a500e522ce254f34681c67c6b2f3300cd8 Mon Sep 17 00:00:00 2001 From: ewy Date: Sat, 6 Jun 2026 20:20:41 +0200 Subject: remove a bunch of unnecessary pointer manip --- spool/exit.go | 8 ++++---- spool/spool.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spool') diff --git a/spool/exit.go b/spool/exit.go index 23cf9da..77bff44 100644 --- a/spool/exit.go +++ b/spool/exit.go @@ -35,7 +35,7 @@ var ( var Codes []ExitCode var CodeMap = make(map[int]*ExitCode) -func New(num int, message string) ExitCode { +func New(num int, message string) *ExitCode { if CodeMap[num] != nil && num != 0 { _, _ = Warn("redefined error code: %v", num) } @@ -45,14 +45,14 @@ func New(num int, message string) ExitCode { } Codes = append(Codes, c) CodeMap[num] = &c - return c + return &c } -func (e ExitCode) Exit() { +func (e *ExitCode) Exit() { os.Exit(e.Value) } -func (e ExitCode) Next(message string) ExitCode { +func (e *ExitCode) Next(message string) *ExitCode { return New( e.Value+1, message, diff --git a/spool/spool.go b/spool/spool.go index 4335d50..ce02dc5 100644 --- a/spool/spool.go +++ b/spool/spool.go @@ -25,7 +25,7 @@ var Warn = func(format string, values ...any) (any, error) { return fmt.Fprintf(Stderr, format, values...) } -var Panic = func(code ExitCode, format string, values ...any) (any, error) { +var Panic = func(code *ExitCode, format string, values ...any) (any, error) { pkg := reflect.TypeOf(empty{}).PkgPath() v, err := fmt.Fprintf(Stderr, format, values...) st := strings.Split(string(debug.Stack()), "\n") -- cgit v1.3.1