pass pointers to factory methods

This commit is contained in:
onyx-and-iris 2026-02-01 15:09:45 +00:00
parent 89ab8ee258
commit 72f43452a8
3 changed files with 8 additions and 8 deletions

View File

@ -58,10 +58,10 @@ func NewClient(mixerIP string, mixerPort int, opts ...Option) (*Client, error) {
c := &Client{
engine: *e,
}
c.Main = newMain(*c)
c.Strip = NewStrip(*c)
c.Bus = NewBus(*c)
c.HeadAmp = NewHeadAmp(*c)
c.Main = newMain(c)
c.Strip = NewStrip(c)
c.Bus = NewBus(c)
c.HeadAmp = NewHeadAmp(c)
return c, nil
}

View File

@ -4,10 +4,10 @@ import "fmt"
type HeadAmp struct {
baseAddress string
client Client
client *Client
}
func NewHeadAmp(c Client) *HeadAmp {
func NewHeadAmp(c *Client) *HeadAmp {
return &HeadAmp{
baseAddress: c.addressMap["headamp"],
client: c,

View File

@ -3,10 +3,10 @@ package xair
import "fmt"
type Main struct {
client Client
client *Client
}
func newMain(c Client) *Main {
func newMain(c *Client) *Main {
return &Main{
client: c,
}