Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ linters-settings:
- standard # Captures all standard packages if they do not match another section.
- default # Contains all imports that could not be matched to another section type.
- prefix(github.com/daixiang0/gci) # Groups all imports with the specified Prefix.

gocritic:
disable-all: true
enabled-checks:
# suggest removing unnecessary strings.Compare
- stringsCompare
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
Expand All @@ -56,6 +60,7 @@ linters-settings:
linters:
disable-all: true
enable:
- gocritic
- gofmt
- gofumpt
- goimports
Expand Down
6 changes: 3 additions & 3 deletions pkg/parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func (l ImportList) Len() int {
}

func (l ImportList) Less(i, j int) bool {
if strings.Compare(l[i].Path, l[j].Path) == 0 {
return strings.Compare(l[i].Name, l[j].Name) < 0
if l[i].Path == l[j].Path {
return l[i].Name < l[j].Name
}

return strings.Compare(l[i].Path, l[j].Path) < 0
return l[i].Path < l[j].Path
}

func (l ImportList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
Expand Down