Skip to content

Commit 71f1759

Browse files
aykevldeadprogram
authored andcommitted
gap: Set and SetRandom methods should have a pointer receiver
Without it, these calls are a no-op. Fixes: #144 In particular, this fixes a problem where IsRandom() would always return false on Linux. With this fix, it correctly returns whether the address is a random address.
1 parent d4bca3e commit 71f1759

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

gap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ func (mac MACAddress) IsRandom() bool {
2525
}
2626

2727
// SetRandom if is a random address.
28-
func (mac MACAddress) SetRandom(val bool) {
28+
func (mac *MACAddress) SetRandom(val bool) {
2929
mac.isRandom = val
3030
}
3131

3232
// Set the address
33-
func (mac MACAddress) Set(val string) {
33+
func (mac *MACAddress) Set(val string) {
3434
m, err := ParseMAC(val)
3535
if err != nil {
3636
return

gap_darwin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ func (ad Address) IsRandom() bool {
2020
}
2121

2222
// SetRandom ignored on macOS.
23-
func (ad Address) SetRandom(val bool) {
23+
func (ad *Address) SetRandom(val bool) {
2424
}
2525

2626
// Set the address
27-
func (ad Address) Set(val string) {
27+
func (ad *Address) Set(val string) {
2828
uuid, err := ParseUUID(val)
2929
if err != nil {
3030
return

0 commit comments

Comments
 (0)