Skip to content

Commit 4e45559

Browse files
committed
chore: Update lint to use golangci-lint v2.3.1
1 parent 50b7d2a commit 4e45559

File tree

6 files changed

+108
-74
lines changed

6 files changed

+108
-74
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ jobs:
3030
go-version: "1.24"
3131
- name: Checkout code
3232
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33-
- name: >
34-
Verify go mod tidy. If you're reading this and the check has
35-
failed, run `goimports -w . && go mod tidy && golangci-lint run`
33+
- name: lint
3634
run: |
37-
go mod tidy && git diff --exit-code
38-
- name: golangci-lint
39-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
40-
with:
41-
version: latest
42-
args: --timeout 3m
35+
./build.sh lint_ci

.golangci.bck.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2022 Google LLC.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# .golangci.yml
15+
linters:
16+
disable-all: true
17+
enable:
18+
# From https://golangci-lint.run/usage/linters/
19+
# This is a minor deviation from the default linters
20+
- goimports
21+
- gosimple
22+
- govet
23+
- ineffassign
24+
- revive
25+
- staticcheck
26+
- unused
27+
issues:
28+
exclude-use-default: false
29+
linters-settings:
30+
revive:
31+
rules:
32+
# From https://revive.run/docs#recommended-configuration
33+
- name: blank-imports
34+
- name: context-as-argument
35+
- name: context-keys-type
36+
- name: dot-imports
37+
- name: empty-block
38+
- name: errorf
39+
- name: error-naming
40+
- name: error-return
41+
- name: error-strings
42+
- name: exported
43+
- name: if-return
44+
- name: import-shadowing
45+
- name: increment-decrement
46+
- name: indent-error-flow
47+
- name: range
48+
- name: range-val-address
49+
- name: range-val-in-closure
50+
- name: receiver-naming
51+
- name: redefines-builtin-id
52+
- name: superfluous-else
53+
- name: time-naming
54+
- name: unexported-return
55+
- name: unreachable-code
56+
- name: unused-parameter
57+
- name: var-declaration
58+
- name: var-naming

.golangci.yml

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,53 @@
1-
# Copyright 2022 Google LLC.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
# .golangci.yml
1+
version: "2"
152
linters:
16-
disable-all: true
3+
default: none
174
enable:
18-
# From https://golangci-lint.run/usage/linters/
19-
# This is a minor deviation from the default linters
20-
- goimports
21-
- gosimple
225
- govet
236
- ineffassign
247
- revive
258
- staticcheck
269
- unused
27-
issues:
28-
exclude-use-default: false
29-
linters-settings:
30-
revive:
31-
rules:
32-
# From https://revive.run/docs#recommended-configuration
33-
- name: blank-imports
34-
- name: context-as-argument
35-
- name: context-keys-type
36-
- name: dot-imports
37-
- name: empty-block
38-
- name: errorf
39-
- name: error-naming
40-
- name: error-return
41-
- name: error-strings
42-
- name: exported
43-
- name: if-return
44-
- name: import-shadowing
45-
- name: increment-decrement
46-
- name: indent-error-flow
47-
- name: range
48-
- name: range-val-address
49-
- name: range-val-in-closure
50-
- name: receiver-naming
51-
- name: redefines-builtin-id
52-
- name: superfluous-else
53-
- name: time-naming
54-
- name: unexported-return
55-
- name: unreachable-code
56-
- name: unused-parameter
57-
- name: var-declaration
58-
- name: var-naming
10+
settings:
11+
revive:
12+
rules:
13+
- name: blank-imports
14+
- name: context-as-argument
15+
- name: context-keys-type
16+
- name: dot-imports
17+
- name: empty-block
18+
- name: errorf
19+
- name: error-naming
20+
- name: error-return
21+
- name: error-strings
22+
- name: exported
23+
- name: if-return
24+
- name: import-shadowing
25+
- name: increment-decrement
26+
- name: indent-error-flow
27+
- name: range
28+
- name: range-val-address
29+
- name: range-val-in-closure
30+
- name: receiver-naming
31+
- name: redefines-builtin-id
32+
- name: superfluous-else
33+
- name: time-naming
34+
- name: unexported-return
35+
- name: unreachable-code
36+
- name: unused-parameter
37+
- name: var-declaration
38+
- name: var-naming
39+
exclusions:
40+
generated: lax
41+
paths:
42+
- third_party$
43+
- builtin$
44+
- examples$
45+
formatters:
46+
enable:
47+
- goimports
48+
exclusions:
49+
generated: lax
50+
paths:
51+
- third_party$
52+
- builtin$
53+
- examples$

cmd/gendocs/gen_cloud-sql-proxy_docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ func main() {
4646

4747
cloudSQLProxy := cmd.NewCommand()
4848
cloudSQLProxy.Execute()
49-
cloudSQLProxy.Command.DisableAutoGenTag = true
49+
cloudSQLProxy.DisableAutoGenTag = true
5050
doc.GenMarkdownTree(cloudSQLProxy.Command, outDir)
5151
}

internal/proxy/fuse_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func SupportsFUSE() error {
3434
if _, err := os.Stat(macfusePath); err != nil {
3535
// if that fails, check for osxfuse next
3636
if _, err := os.Stat(osxfusePath); err != nil {
37-
return errors.New("failed to find osxfuse or macfuse: verify FUSE installation and try again (see https://osxfuse.github.io).")
37+
return errors.New("failed to find osxfuse or macfuse: verify FUSE installation and try again (see https://osxfuse.github.io)")
3838
}
3939
}
4040
return nil

internal/proxy/proxy_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ func (f *fakeDialer) dialAttempts() int {
5252
return f.dialCount
5353
}
5454

55-
func (f *fakeDialer) engineVersionAttempts() int {
56-
f.mu.Lock()
57-
defer f.mu.Unlock()
58-
return f.engineVersionCount
59-
}
60-
61-
func (f *fakeDialer) dialedInstances() []string {
62-
f.mu.Lock()
63-
defer f.mu.Unlock()
64-
return append([]string{}, f.instances...)
65-
}
66-
6755
func (f *fakeDialer) Dial(_ context.Context, inst string, _ ...cloudsqlconn.DialOption) (net.Conn, error) {
6856
f.mu.Lock()
6957
defer f.mu.Unlock()

0 commit comments

Comments
 (0)