• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yitsushi / macpot / 5047895837

pending completion
5047895837

push

github

GitHub
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3

180 of 192 relevant lines covered (93.75%)

10.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/with_nic.go
1
package macpot
2

3
import (
4
        "fmt"
5
        "strconv"
6
        "strings"
7
)
8

9
// WithNIC is an Option for New() that sets the generated MAC address with fixed
10
// NIC.
11
func WithNIC(nic string) Option {
4✔
12
        parts := strings.Split(nic, ":")
4✔
13

4✔
14
        return func(mac *MAC) error {
8✔
15
                if len(parts) != nicByteLength {
6✔
16
                        return NICError{Message: fmt.Sprintf("invalid NIC: %s", nic)}
2✔
17
                }
2✔
18

19
                for idx := 0; idx < nicByteLength; idx++ {
7✔
20
                        value, err := strconv.ParseInt(parts[idx], base16, ipIntSize)
5✔
21
                        if err != nil {
6✔
22
                                return NICError{Message: err.Error()}
1✔
23
                        }
1✔
24

25
                        if err := mac.SetOctet(ouiByteLength+idx, byte(value)); err != nil {
4✔
26
                                return err
×
27
                        }
×
28
                }
29

30
                return nil
1✔
31
        }
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc