From 2a604ff997cc790103b6f1fbee7c5801aae6676c Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Fri, 31 May 2024 19:47:19 +0200 Subject: [PATCH] enable gofmt linter Signed-off-by: Matthieu MOREL --- .golangci.yml | 1 + net_conntrackstat_test.go | 10 +++++----- net_udp_test.go | 10 +++++----- proc_test.go | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 126df9e67..1e60e9096 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,6 +3,7 @@ linters: enable: - errcheck - godot + - gofmt - gosimple - govet - ineffassign diff --git a/net_conntrackstat_test.go b/net_conntrackstat_test.go index b19222a4f..67aa18dee 100644 --- a/net_conntrackstat_test.go +++ b/net_conntrackstat_test.go @@ -34,7 +34,7 @@ func TestParseConntrackStat(t *testing.T) { } want := []ConntrackStatEntry{ - ConntrackStatEntry{ + { Entries: 33, Found: 0, Invalid: 3, @@ -45,7 +45,7 @@ func TestParseConntrackStat(t *testing.T) { EarlyDrop: 0, SearchRestart: 0, }, - ConntrackStatEntry{ + { Entries: 33, Found: 0, Invalid: 2, @@ -56,7 +56,7 @@ func TestParseConntrackStat(t *testing.T) { EarlyDrop: 0, SearchRestart: 2, }, - ConntrackStatEntry{ + { Entries: 33, Found: 0, Invalid: 1, @@ -67,7 +67,7 @@ func TestParseConntrackStat(t *testing.T) { EarlyDrop: 0, SearchRestart: 1, }, - ConntrackStatEntry{ + { Entries: 33, Found: 0, Invalid: 47, @@ -96,7 +96,7 @@ func TestParseOldConntrackStat(t *testing.T) { } want := []ConntrackStatEntry{ - ConntrackStatEntry{ + { Entries: 43, Searched: 202143, Found: 48658538, diff --git a/net_udp_test.go b/net_udp_test.go index 657616109..0db53bffd 100644 --- a/net_udp_test.go +++ b/net_udp_test.go @@ -30,7 +30,7 @@ func Test_newNetUDP(t *testing.T) { name: "udp file found, no error should come up", file: "testdata/fixtures/proc/net/udp", want: []*netIPSocketLine{ - &netIPSocketLine{ + { Sl: 0, LocalAddr: net.IP{10, 0, 0, 5}, LocalPort: 22, @@ -43,7 +43,7 @@ func Test_newNetUDP(t *testing.T) { Inode: 2740, Drops: intToU64(100), }, - &netIPSocketLine{ + { Sl: 1, LocalAddr: net.IP{0, 0, 0, 0}, LocalPort: 22, @@ -56,7 +56,7 @@ func Test_newNetUDP(t *testing.T) { Inode: 2740, Drops: intToU64(100), }, - &netIPSocketLine{ + { Sl: 2, LocalAddr: net.IP{0, 0, 0, 0}, LocalPort: 22, @@ -76,7 +76,7 @@ func Test_newNetUDP(t *testing.T) { name: "udp6 file found, no error should come up", file: "testdata/fixtures/proc/net/udp6", want: []*netIPSocketLine{ - &netIPSocketLine{ + { Sl: 1315, LocalAddr: net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, LocalPort: 5355, @@ -89,7 +89,7 @@ func Test_newNetUDP(t *testing.T) { Inode: 21040, Drops: intToU64(0), }, - &netIPSocketLine{ + { Sl: 6073, LocalAddr: net.IP{254, 128, 0, 0, 0, 0, 0, 0, 86, 225, 173, 255, 254, 124, 102, 9}, LocalPort: 51073, diff --git a/proc_test.go b/proc_test.go index 239e35b17..ecf889acb 100644 --- a/proc_test.go +++ b/proc_test.go @@ -257,9 +257,9 @@ func TestFileDescriptorsInfo(t *testing.T) { sort.Sort(fdinfos) var want = ProcFDInfos{ ProcFDInfo{FD: "0", Pos: "0", Flags: "02004000", MntID: "13", InotifyInfos: []InotifyInfo{ - InotifyInfo{WD: "3", Ino: "1", Sdev: "34", Mask: "fce"}, - InotifyInfo{WD: "2", Ino: "1300016", Sdev: "fd00002", Mask: "fce"}, - InotifyInfo{WD: "1", Ino: "2e0001", Sdev: "fd00000", Mask: "fce"}, + {WD: "3", Ino: "1", Sdev: "34", Mask: "fce"}, + {WD: "2", Ino: "1300016", Sdev: "fd00002", Mask: "fce"}, + {WD: "1", Ino: "2e0001", Sdev: "fd00000", Mask: "fce"}, }}, ProcFDInfo{FD: "1", Pos: "0", Flags: "02004002", MntID: "13", InotifyInfos: nil}, ProcFDInfo{FD: "10", Pos: "0", Flags: "02004002", MntID: "9", InotifyInfos: nil},