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{ c := &Client{
engine: *e, engine: *e,
} }
c.Main = newMain(*c) c.Main = newMain(c)
c.Strip = NewStrip(*c) c.Strip = NewStrip(c)
c.Bus = NewBus(*c) c.Bus = NewBus(c)
c.HeadAmp = NewHeadAmp(*c) c.HeadAmp = NewHeadAmp(c)
return c, nil return c, nil
} }

View File

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

View File

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