Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(lint): correct gci linter #1443

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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