Skip to content

Commit

Permalink
refactor: simplify init
Browse files Browse the repository at this point in the history
  • Loading branch information
aofei committed Aug 15, 2020
1 parent 508e1f7 commit b885963
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sandid.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ func init() {

copy(hardwareAddress[:], b[3:])
hardwareAddress[0] |= 0x01
if is, err := net.Interfaces(); err == nil {
for _, i := range is {
if len(i.HardwareAddr) >= 6 {
copy(hardwareAddress[:], i.HardwareAddr)
break
}
netInterfaces, _ := net.Interfaces()
for _, ni := range netInterfaces {
if len(ni.HardwareAddr) >= 6 {
copy(hardwareAddress[:], ni.HardwareAddr)
break
}
}

Expand Down

0 comments on commit b885963

Please sign in to comment.