Skip to content

Commit 731d14b

Browse files
authored
Merge pull request #1017 from size12/linter5
enabled gci
2 parents 40bb25e + f41ed52 commit 731d14b

File tree

21 files changed

+17
-27
lines changed

21 files changed

+17
-27
lines changed

.github/scripts/format-go-code.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ FILEPATH="$1"
66

77
gofmt -s -w "$FILEPATH"
88

9-
# https://github.com/rinchsan/gosimports
9+
# https://github.com/daixiang0/gci
1010
if [[ "$FILEPATH" == *"tests/slo/"* ]]
1111
then
12-
gosimports -local slo -w "$FILEPATH"
12+
gci write --skip-generated -s standard -s default -s "prefix(slo)" "$FILEPATH"
13+
elif [[ "$FILEPATH" == *"examples/"* ]]
14+
then
15+
gci write --skip-generated -s standard -s default -s "prefix(examples)" "$FILEPATH"
1316
else
14-
gosimports -local github.com/ydb-platform/ydb-go-sdk/v3 -w "$FILEPATH"
17+
gci write --skip-generated -s standard -s default -s "prefix(github.com/ydb-platform/ydb-go-sdk/v3)" "$FILEPATH"
1518
fi
1619

1720

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Install utilities
7070
run: |
7171
go install mvdan.cc/gofumpt@v0.3.1
72-
go install github.com/rinchsan/gosimports/cmd/gosimports@v0.1.5
72+
go install github.com/daixiang0/gci@v0.12.1
7373
- name: format all files with auto-formatter
7474
run: bash ./.github/scripts/format-all-go-code.sh "$PWD"
7575
- name: Check repository diff

.golangci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ linters-settings:
6464
# put imports beginning with prefix after 3rd-party packages;
6565
# it's a comma-separated list of prefixes
6666
local-prefixes: github.com/ydb-platform/ydb-go-sdk/v3
67+
gci:
68+
sections:
69+
- standard # Standard section: captures all standard packages.
70+
- default # Default section: contains all imports that could not be matched to another section type.
71+
- prefix(github.com/ydb-platform/ydb-go-sdk/v3) # Custom section: groups all imports with the specified Prefix.
72+
skip-generated: true
6773
goconst:
6874
# minimal length of string constant, 3 by default
6975
min-len: 2
@@ -220,7 +226,6 @@ linters:
220226
- forbidigo
221227
- forcetypeassert
222228
- funlen
223-
- gci
224229
- gochecknoglobals
225230
- gocognit
226231
- godot

examples/auth/environ/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"os"
77

88
environ "github.com/ydb-platform/ydb-go-sdk-auth-environ"
9-
109
ydb "github.com/ydb-platform/ydb-go-sdk/v3"
1110
)
1211

examples/auth/metadata_credentials/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
66
"fmt"
77
"os"
88

9-
yc "github.com/ydb-platform/ydb-go-yc"
10-
119
ydb "github.com/ydb-platform/ydb-go-sdk/v3"
10+
yc "github.com/ydb-platform/ydb-go-yc"
1211
)
1312

1413
var dsn string

examples/auth/service_account_credentials/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
66
"fmt"
77
"os"
88

9-
yc "github.com/ydb-platform/ydb-go-yc"
10-
119
ydb "github.com/ydb-platform/ydb-go-sdk/v3"
10+
yc "github.com/ydb-platform/ydb-go-yc"
1211
)
1312

1413
var (

examples/basic/database_sql/data.go

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

1010
"github.com/google/uuid"
11-
1211
"github.com/ydb-platform/ydb-go-sdk/v3/table/types"
1312
)
1413

examples/basic/database_sql/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"time"
1010

1111
environ "github.com/ydb-platform/ydb-go-sdk-auth-environ"
12-
1312
"github.com/ydb-platform/ydb-go-sdk/v3"
1413
"github.com/ydb-platform/ydb-go-sdk/v3/sugar"
1514
)

examples/basic/native/main.go

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

1010
environ "github.com/ydb-platform/ydb-go-sdk-auth-environ"
11-
1211
"github.com/ydb-platform/ydb-go-sdk/v3"
1312
"github.com/ydb-platform/ydb-go-sdk/v3/sugar"
1413
)

examples/basic/xorm/main.go

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

99
_ "github.com/lib/pq"
10+
_ "github.com/ydb-platform/ydb-go-sdk/v3"
1011
_ "modernc.org/sqlite"
1112
"xorm.io/builder"
1213
"xorm.io/xorm"
1314
xormLog "xorm.io/xorm/log"
14-
15-
_ "github.com/ydb-platform/ydb-go-sdk/v3"
1615
)
1716

1817
var envNotFoundMessage = `DSN environment variable not defined

0 commit comments

Comments
 (0)