Skip to content

Commit

Permalink
enable gofmt and goimports linter (prometheus#646)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 authored Jun 3, 2024
1 parent 1754b78 commit ec61d8a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ linters:
enable:
- errcheck
- godot
- gofmt
- goimports
- gosimple
- govet
- ineffassign
Expand All @@ -18,5 +20,7 @@ linter-settings:
exclude:
# Ignore "See: URL"
- 'See:'
goimports:
local-prefixes: github.com/prometheus/procfs
misspell:
locale: US
7 changes: 5 additions & 2 deletions mdstat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@

package procfs

import "testing"
import "github.com/google/go-cmp/cmp"
import (
"testing"

"github.com/google/go-cmp/cmp"
)

func TestFS_MDStat(t *testing.T) {
fs := getProcFixtures(t)
Expand Down
10 changes: 5 additions & 5 deletions net_conntrackstat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestParseConntrackStat(t *testing.T) {
}

want := []ConntrackStatEntry{
ConntrackStatEntry{
{
Entries: 33,
Found: 0,
Invalid: 3,
Expand All @@ -45,7 +45,7 @@ func TestParseConntrackStat(t *testing.T) {
EarlyDrop: 0,
SearchRestart: 0,
},
ConntrackStatEntry{
{
Entries: 33,
Found: 0,
Invalid: 2,
Expand All @@ -56,7 +56,7 @@ func TestParseConntrackStat(t *testing.T) {
EarlyDrop: 0,
SearchRestart: 2,
},
ConntrackStatEntry{
{
Entries: 33,
Found: 0,
Invalid: 1,
Expand All @@ -67,7 +67,7 @@ func TestParseConntrackStat(t *testing.T) {
EarlyDrop: 0,
SearchRestart: 1,
},
ConntrackStatEntry{
{
Entries: 33,
Found: 0,
Invalid: 47,
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestParseOldConntrackStat(t *testing.T) {
}

want := []ConntrackStatEntry{
ConntrackStatEntry{
{
Entries: 43,
Searched: 202143,
Found: 48658538,
Expand Down
10 changes: 5 additions & 5 deletions net_udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions proc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
3 changes: 2 additions & 1 deletion sysfs/class_thermal.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
"strings"
"syscall"

"github.com/prometheus/procfs/internal/util"
fsp "io/fs"

"github.com/prometheus/procfs/internal/util"
)

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

0 comments on commit ec61d8a

Please sign in to comment.