From 2653e7aab324809de23acdc10066f8101c82996d Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Thu, 15 Aug 2019 15:05:34 +0200 Subject: [PATCH] define constants outside of loop --- arp.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arp.go b/arp.go index f3cd8cf3b..916c9182a 100644 --- a/arp.go +++ b/arp.go @@ -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