diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-03 01:49:27 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-03 01:49:27 +0900 |
| commit | ae66b3d2fb2f1f65f6ca8932e8044114e609d0b4 (patch) | |
| tree | 3079bfec79b4ac5aada225bfa0da4e631d128741 /message | |
| parent | 149bc3671a499cce0b5719d7396355fabfa7fc2a (diff) | |
message: rename NewMsg to New
Should have done this when relocating this from container. Now is a good time to rename it before v0.3.x.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'message')
| -rw-r--r-- | message/message.go | 8 | ||||
| -rw-r--r-- | message/message_test.go | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/message/message.go b/message/message.go index 36f8ae4b..aa4870f9 100644 --- a/message/message.go +++ b/message/message.go @@ -52,7 +52,7 @@ type Msg interface { } // defaultMsg is the default implementation of the [Msg] interface. -// The zero value is not safe for use. Callers should use the [NewMsg] function instead. +// The zero value is not safe for use. Callers should use the [New] function instead. type defaultMsg struct { verbose atomic.Bool @@ -60,10 +60,10 @@ type defaultMsg struct { Suspendable } -// NewMsg initialises a downstream [log.Logger] for a new [Msg]. -// The [log.Logger] should no longer be configured after NewMsg returns. +// New initialises a downstream [log.Logger] for a new [Msg]. +// The [log.Logger] should no longer be configured after [New] returns. // If downstream is nil, a new logger is initialised in its place. -func NewMsg(downstream *log.Logger) Msg { +func New(downstream *log.Logger) Msg { if downstream == nil { downstream = log.New(log.Writer(), "container: ", 0) } diff --git a/message/message_test.go b/message/message_test.go index 6b781e3f..c455b7e2 100644 --- a/message/message_test.go +++ b/message/message_test.go @@ -51,7 +51,7 @@ func TestDefaultMsg(t *testing.T) { t.Run("logger", func(t *testing.T) { t.Run("nil", func(t *testing.T) { - got := message.NewMsg(nil).GetLogger() + got := message.New(nil).GetLogger() if out := got.Writer().(*message.Suspendable).Downstream; out != log.Writer() { t.Errorf("GetLogger: Downstream = %#v", out) @@ -64,7 +64,7 @@ func TestDefaultMsg(t *testing.T) { t.Run("takeover", func(t *testing.T) { l := log.New(io.Discard, "\x00", 0xdeadbeef) - got := message.NewMsg(l) + got := message.New(l) if logger := got.GetLogger(); logger != l { t.Errorf("GetLogger: %#v, want %#v", logger, l) @@ -169,7 +169,7 @@ func TestDefaultMsg(t *testing.T) { }}, } - msg := message.NewMsg(log.New(&dw, "test: ", 0)) + msg := message.New(log.New(&dw, "test: ", 0)) for _, step := range steps { // these share the same writer, so cannot be subtests t.Logf("running step %q", step.name) |
