Skip to content

Commit ec61d8a

Browse files
authored
enable gofmt and goimports linter (#646)
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 1754b78 commit ec61d8a

6 files changed

+24
-16
lines changed

.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ linters:
33
enable:
44
- errcheck
55
- godot
6+
- gofmt
7+
- goimports
68
- gosimple
79
- govet
810
- ineffassign
@@ -18,5 +20,7 @@ linter-settings:
1820
exclude:
1921
# Ignore "See: URL"
2022
- 'See:'
23+
goimports:
24+
local-prefixes: github.com/prometheus/procfs
2125
misspell:
2226
locale: US

mdstat_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313

1414
package procfs
1515

16-
import "testing"
17-
import "github.com/google/go-cmp/cmp"
16+
import (
17+
"testing"
18+
19+
"github.com/google/go-cmp/cmp"
20+
)
1821

1922
func TestFS_MDStat(t *testing.T) {
2023
fs := getProcFixtures(t)

net_conntrackstat_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestParseConntrackStat(t *testing.T) {
3434
}
3535

3636
want := []ConntrackStatEntry{
37-
ConntrackStatEntry{
37+
{
3838
Entries: 33,
3939
Found: 0,
4040
Invalid: 3,
@@ -45,7 +45,7 @@ func TestParseConntrackStat(t *testing.T) {
4545
EarlyDrop: 0,
4646
SearchRestart: 0,
4747
},
48-
ConntrackStatEntry{
48+
{
4949
Entries: 33,
5050
Found: 0,
5151
Invalid: 2,
@@ -56,7 +56,7 @@ func TestParseConntrackStat(t *testing.T) {
5656
EarlyDrop: 0,
5757
SearchRestart: 2,
5858
},
59-
ConntrackStatEntry{
59+
{
6060
Entries: 33,
6161
Found: 0,
6262
Invalid: 1,
@@ -67,7 +67,7 @@ func TestParseConntrackStat(t *testing.T) {
6767
EarlyDrop: 0,
6868
SearchRestart: 1,
6969
},
70-
ConntrackStatEntry{
70+
{
7171
Entries: 33,
7272
Found: 0,
7373
Invalid: 47,
@@ -96,7 +96,7 @@ func TestParseOldConntrackStat(t *testing.T) {
9696
}
9797

9898
want := []ConntrackStatEntry{
99-
ConntrackStatEntry{
99+
{
100100
Entries: 43,
101101
Searched: 202143,
102102
Found: 48658538,

net_udp_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func Test_newNetUDP(t *testing.T) {
3030
name: "udp file found, no error should come up",
3131
file: "testdata/fixtures/proc/net/udp",
3232
want: []*netIPSocketLine{
33-
&netIPSocketLine{
33+
{
3434
Sl: 0,
3535
LocalAddr: net.IP{10, 0, 0, 5},
3636
LocalPort: 22,
@@ -43,7 +43,7 @@ func Test_newNetUDP(t *testing.T) {
4343
Inode: 2740,
4444
Drops: intToU64(100),
4545
},
46-
&netIPSocketLine{
46+
{
4747
Sl: 1,
4848
LocalAddr: net.IP{0, 0, 0, 0},
4949
LocalPort: 22,
@@ -56,7 +56,7 @@ func Test_newNetUDP(t *testing.T) {
5656
Inode: 2740,
5757
Drops: intToU64(100),
5858
},
59-
&netIPSocketLine{
59+
{
6060
Sl: 2,
6161
LocalAddr: net.IP{0, 0, 0, 0},
6262
LocalPort: 22,
@@ -76,7 +76,7 @@ func Test_newNetUDP(t *testing.T) {
7676
name: "udp6 file found, no error should come up",
7777
file: "testdata/fixtures/proc/net/udp6",
7878
want: []*netIPSocketLine{
79-
&netIPSocketLine{
79+
{
8080
Sl: 1315,
8181
LocalAddr: net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
8282
LocalPort: 5355,
@@ -89,7 +89,7 @@ func Test_newNetUDP(t *testing.T) {
8989
Inode: 21040,
9090
Drops: intToU64(0),
9191
},
92-
&netIPSocketLine{
92+
{
9393
Sl: 6073,
9494
LocalAddr: net.IP{254, 128, 0, 0, 0, 0, 0, 0, 86, 225, 173, 255, 254, 124, 102, 9},
9595
LocalPort: 51073,

proc_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ func TestFileDescriptorsInfo(t *testing.T) {
257257
sort.Sort(fdinfos)
258258
var want = ProcFDInfos{
259259
ProcFDInfo{FD: "0", Pos: "0", Flags: "02004000", MntID: "13", InotifyInfos: []InotifyInfo{
260-
InotifyInfo{WD: "3", Ino: "1", Sdev: "34", Mask: "fce"},
261-
InotifyInfo{WD: "2", Ino: "1300016", Sdev: "fd00002", Mask: "fce"},
262-
InotifyInfo{WD: "1", Ino: "2e0001", Sdev: "fd00000", Mask: "fce"},
260+
{WD: "3", Ino: "1", Sdev: "34", Mask: "fce"},
261+
{WD: "2", Ino: "1300016", Sdev: "fd00002", Mask: "fce"},
262+
{WD: "1", Ino: "2e0001", Sdev: "fd00000", Mask: "fce"},
263263
}},
264264
ProcFDInfo{FD: "1", Pos: "0", Flags: "02004002", MntID: "13", InotifyInfos: nil},
265265
ProcFDInfo{FD: "10", Pos: "0", Flags: "02004002", MntID: "9", InotifyInfos: nil},

sysfs/class_thermal.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import (
2323
"strings"
2424
"syscall"
2525

26-
"github.com/prometheus/procfs/internal/util"
2726
fsp "io/fs"
27+
28+
"github.com/prometheus/procfs/internal/util"
2829
)
2930

3031
// ClassThermalZoneStats contains info from files in /sys/class/thermal/thermal_zone<zone>

0 commit comments

Comments
 (0)