Skip to content

Commit

Permalink
Merge pull request #1443 from mmorel-35/linter
Browse files Browse the repository at this point in the history
ci(lint): correct gci linter
  • Loading branch information
shirou committed Apr 6, 2023
2 parents 755bcab + 1fb1e3e commit cf428f8
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ linters:
- structcheck
- unused
- varcheck

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/shirou)
3 changes: 2 additions & 1 deletion cpu/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import (
"strconv"
"strings"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/tklauser/go-sysconf"

"github.com/shirou/gopsutil/v3/internal/common"
)

var ClocksPerSec = float64(100)
Expand Down
3 changes: 2 additions & 1 deletion cpu/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"testing"
"time"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/stretchr/testify/assert"

"github.com/shirou/gopsutil/v3/internal/common"
)

func skipIfNotImplementedErr(t *testing.T, err error) {
Expand Down
3 changes: 2 additions & 1 deletion disk/disk_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import (
"strconv"
"strings"

"github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"

"github.com/shirou/gopsutil/v3/internal/common"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion host/host_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"strconv"
"strings"

"github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"

"github.com/shirou/gopsutil/v3/internal/common"
)

type lsbStruct struct {
Expand Down
3 changes: 2 additions & 1 deletion mem/mem_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
"strconv"
"strings"

"github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"

"github.com/shirou/gopsutil/v3/internal/common"
)

type VirtualMemoryExStat struct {
Expand Down
3 changes: 2 additions & 1 deletion mem/mem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"runtime"
"testing"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/stretchr/testify/assert"

"github.com/shirou/gopsutil/v3/internal/common"
)

func skipIfNotImplementedErr(t *testing.T, err error) {
Expand Down
5 changes: 4 additions & 1 deletion net/net_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"syscall"
"testing"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/stretchr/testify/assert"

"github.com/shirou/gopsutil/v3/internal/common"
)

func TestIOCountersByFileParsing(t *testing.T) {
Expand Down Expand Up @@ -248,6 +249,7 @@ entries searched found new invalid ignore delete deleteList insert insertFailed

// Function under test
stats, err := conntrackStatsFromFile(tmpfile.Name(), true)
assert.Nil(t, err)
assert.Equal(t, 8, len(stats), "Expected 8 results")

summary := &ConntrackStat{}
Expand Down Expand Up @@ -308,6 +310,7 @@ entries searched found new invalid ignore delete deleteList insert insertFailed

// Test summary grouping
totals, err := conntrackStatsFromFile(tmpfile.Name(), false)
assert.Nil(t, err)
for i, st := range totals {
assert.Equal(t, summary.Entries, st.Entries)
assert.Equal(t, summary.Searched, st.Searched)
Expand Down
5 changes: 3 additions & 2 deletions process/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import (
"strconv"
"strings"

"github.com/tklauser/go-sysconf"
"golang.org/x/sys/unix"

"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/internal/common"
"github.com/shirou/gopsutil/v3/net"
"github.com/tklauser/go-sysconf"
"golang.org/x/sys/unix"
)

var pageSize = uint64(os.Getpagesize())
Expand Down
3 changes: 2 additions & 1 deletion process/process_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
"strings"
"syscall"

"github.com/shirou/gopsutil/v3/internal/common"
"golang.org/x/sys/unix"

"github.com/shirou/gopsutil/v3/internal/common"
)

type Signal = syscall.Signal
Expand Down
3 changes: 2 additions & 1 deletion process/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import (
"testing"
"time"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/stretchr/testify/assert"

"github.com/shirou/gopsutil/v3/internal/common"
)

var mu sync.Mutex
Expand Down

0 comments on commit cf428f8

Please sign in to comment.