Skip to content

Commit edd76d8

Browse files
authored
chore: add support for gci, sloglint, loggercheck, grouper (#4058)
1 parent 151e9de commit edd76d8

File tree

96 files changed

+102
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+102
-197
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ linters:
1616
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
1717
- durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
1818
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
19+
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
1920
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
2021
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
2122
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
@@ -25,16 +26,19 @@ linters:
2526
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
2627
- gosimple #(megacheck): Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
2728
- govet #(vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
29+
- grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
2830
- importas # Enforces consistent import aliases [fast: false, auto-fix: false]
2931
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
3032
- intrange # intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false]
33+
- loggercheck # (logrlint): Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]
3134
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
3235
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
3336
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
3437
- prealloc # Finds slice declarations that could potentially be pre-allocated [fast: true, auto-fix: false]
3538
- predeclared # find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false]
3639
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
3740
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
41+
- sloglint # ensure consistent code style when using log/slog [fast: false, auto-fix: false]
3842
- staticcheck
3943
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
4044
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]

internal/alias/config_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import (
44
"fmt"
55
"testing"
66

7-
"github.com/scaleway/scaleway-cli/v2/internal/alias"
8-
97
"github.com/alecthomas/assert"
8+
"github.com/scaleway/scaleway-cli/v2/internal/alias"
109
)
1110

1211
func TestConfig_ResolveAliases(t *testing.T) {

internal/args/args_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/scaleway/scaleway-cli/v2/internal/args"
11-
1210
"github.com/alecthomas/assert"
11+
"github.com/scaleway/scaleway-cli/v2/internal/args"
1312
"github.com/scaleway/scaleway-sdk-go/scw"
1413
"github.com/stretchr/testify/require"
1514
)

internal/args/marshal_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import (
44
"testing"
55
"time"
66

7-
"github.com/stretchr/testify/require"
8-
97
"github.com/scaleway/scaleway-cli/v2/internal/args"
10-
118
"github.com/scaleway/scaleway-sdk-go/scw"
129
"github.com/stretchr/testify/assert"
10+
"github.com/stretchr/testify/require"
1311
)
1412

1513
func TestMarshal(t *testing.T) {

internal/args/unmarshal_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import (
66
"testing"
77
"time"
88

9-
"github.com/stretchr/testify/require"
10-
119
"github.com/scaleway/scaleway-cli/v2/internal/args"
12-
1310
"github.com/scaleway/scaleway-sdk-go/scw"
1411
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
1513
)
1614

1715
func init() {

internal/config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import (
88
"runtime"
99
"text/template"
1010

11-
"gopkg.in/yaml.v3"
12-
1311
"github.com/scaleway/scaleway-cli/v2/internal/alias"
1412
"github.com/scaleway/scaleway-sdk-go/scw"
13+
"gopkg.in/yaml.v3"
1514
)
1615

1716
const (

internal/core/alias_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package core_test
33
import (
44
"testing"
55

6-
"github.com/scaleway/scaleway-cli/v2/internal/core"
7-
86
"github.com/alecthomas/assert"
97
"github.com/scaleway/scaleway-cli/v2/internal/alias"
8+
"github.com/scaleway/scaleway-cli/v2/internal/core"
109
)
1110

1211
func TestCommandMatchAlias(t *testing.T) {

internal/core/arg_specs_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package core_test
33
import (
44
"testing"
55

6-
"github.com/scaleway/scaleway-cli/v2/internal/core"
7-
86
"github.com/alecthomas/assert"
7+
"github.com/scaleway/scaleway-cli/v2/internal/core"
98
)
109

1110
func TestOneOf(t *testing.T) {

internal/core/autocomplete_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"testing"
99

1010
"github.com/scaleway/scaleway-cli/v2/internal/core"
11-
1211
"github.com/scaleway/scaleway-cli/v2/internal/platform/terminal"
1312
"github.com/scaleway/scaleway-sdk-go/scw"
1413
"github.com/stretchr/testify/assert"

internal/core/bootstrap_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import (
55
"reflect"
66
"testing"
77

8-
"github.com/scaleway/scaleway-cli/v2/internal/core"
9-
108
"github.com/alecthomas/assert"
119
"github.com/scaleway/scaleway-cli/v2/internal/args"
10+
"github.com/scaleway/scaleway-cli/v2/internal/core"
1211
"github.com/scaleway/scaleway-cli/v2/internal/interactive"
1312
)
1413

0 commit comments

Comments
 (0)