Fix tests and linters
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// +build linux
|
||||
// go:build linux
|
||||
|
||||
package proc
|
||||
|
||||
@@ -7,9 +7,8 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/safing/portmaster/network/socket"
|
||||
|
||||
"github.com/safing/portbase/log"
|
||||
"github.com/safing/portmaster/network/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -128,7 +127,10 @@ func readDirNames(dir string) (names []string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
defer func() {
|
||||
_ = file.Close()
|
||||
}()
|
||||
|
||||
names, err = file.Readdirnames(0)
|
||||
if err != nil {
|
||||
log.Warningf("proc: could not get entries from directory %s: %s", dir, err)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build linux
|
||||
// go:build linux
|
||||
|
||||
package proc
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build linux
|
||||
// go:build linux
|
||||
|
||||
package proc
|
||||
|
||||
@@ -12,9 +12,8 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/safing/portmaster/network/socket"
|
||||
|
||||
"github.com/safing/portbase/log"
|
||||
"github.com/safing/portmaster/network/socket"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -85,7 +84,6 @@ const (
|
||||
)
|
||||
|
||||
func getTableFromSource(stack uint8, procFile string) (connections []*socket.ConnectionInfo, binds []*socket.BindInfo, err error) {
|
||||
|
||||
var ipConverter func(string) net.IP
|
||||
switch stack {
|
||||
case TCP4, UDP4:
|
||||
@@ -101,7 +99,9 @@ func getTableFromSource(stack uint8, procFile string) (connections []*socket.Con
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
defer socketData.Close()
|
||||
defer func() {
|
||||
_ = socketData.Close()
|
||||
}()
|
||||
|
||||
// file scanner
|
||||
scanner := bufio.NewScanner(socketData)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build linux
|
||||
// go:build linux
|
||||
|
||||
package proc
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func TestSockets(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
connections, listeners, err := GetTCP4Table()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user