From fde384b3593751ef45c625ba052dea343cfafe3e Mon Sep 17 00:00:00 2001 From: Wendi Yu Date: Fri, 8 May 2020 17:04:13 -0600 Subject: [PATCH] Fix macOS build staticcheck used to fail on macOS (and presumably windows) due to a variable declared in a common package that was only used by the Linux build, which would prevent `redo pr` from passing on Mac. Moved variable declaration from the common file to the Linux-specific one to resolve the compiler complaint. Signed-off-by: Wendi Yu --- portlist/portlist.go | 2 -- portlist/portlist_linux.go | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/portlist/portlist.go b/portlist/portlist.go index 883f373f7..521edcf49 100644 --- a/portlist/portlist.go +++ b/portlist/portlist.go @@ -21,8 +21,6 @@ type Port struct { // List is a list of Ports. type List []Port -var protos = []string{"tcp", "udp"} - func (a *Port) lessThan(b *Port) bool { if a.Port < b.Port { return true diff --git a/portlist/portlist_linux.go b/portlist/portlist_linux.go index 0e4088635..d8756c253 100644 --- a/portlist/portlist_linux.go +++ b/portlist/portlist_linux.go @@ -24,6 +24,7 @@ // TODO(apenwarr): Include IPv6 ports eventually. // Right now we don't route IPv6 anyway so it's better to exclude them. var sockfiles = []string{"/proc/net/tcp", "/proc/net/udp"} +var protos = []string{"tcp", "udp"} func listPorts() (List, error) { l := []Port{}