Skip to content

Commit

Permalink
define constants outside of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMeier committed Aug 15, 2019
1 parent efaf9fb commit 2653e7a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions arp.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) {
lines := strings.Split(string(data), "\n")
entries := make([]ARPEntry, 0)
var err error

const (
expectedDataWidth = 6
expectedHeaderWidth = 9
)
for _, line := range lines {
columns := strings.Fields(line)
width := len(columns)
expectedDataWidth := 6
expectedHeaderWidth := 9

if width == expectedHeaderWidth || width == 0 {
continue
Expand Down

0 comments on commit 2653e7a

Please sign in to comment.