added pointer receiver

This commit is contained in:
ston1th 2020-06-01 16:37:50 +02:00
commit fb1d8d2647
2 changed files with 6 additions and 6 deletions

View file

@ -24,9 +24,9 @@ func (c *IPConfigs) Set(index int, ipc *IPConfig) {
(*c)[index] = ipc (*c)[index] = ipc
} }
func (c IPConfigs) Get(index int) *IPConfig { func (c *IPConfigs) Get(index int) *IPConfig {
if len(c)-1 >= index { if len(*c)-1 >= index {
return c[index] return (*c)[index]
} }
return nil return nil
} }

View file

@ -25,9 +25,9 @@ func (c *NetworkDevices) Set(index int, d *NetworkDevice) {
(*c)[index] = d (*c)[index] = d
} }
func (c NetworkDevices) Get(index int) *NetworkDevice { func (c *NetworkDevices) Get(index int) *NetworkDevice {
if len(c)-1 >= index { if len(*c)-1 >= index {
return c[index] return (*c)[index]
} }
return nil return nil
} }