Skip to content

Commit 76f018b

Browse files
authored
[auto] update to Go 1.23.6 and enable custom lint rules (#28)
* update Go version to 1.23.6 * enable rulecheck-logfatal custom lint rules
1 parent 767066f commit 76f018b

File tree

21 files changed

+799
-29
lines changed

21 files changed

+799
-29
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- name: Install Go
88
uses: actions/setup-go@v5
99
with:
10-
go-version: 1.22.x
10+
go-version: 1.23.x
1111
- name: Checkout code
1212
uses: actions/checkout@v4
1313
- name: Run linters
@@ -18,7 +18,7 @@ jobs:
1818
go-test:
1919
strategy:
2020
matrix:
21-
go-version: [1.22.x]
21+
go-version: [1.23.x]
2222
platform: [ubuntu-latest]
2323
runs-on: ${{ matrix.platform }}
2424
steps:
@@ -56,7 +56,7 @@ jobs:
5656
- name: Install Go
5757
uses: actions/setup-go@v5
5858
with:
59-
go-version: 1.22.x
59+
go-version: 1.23.x
6060
- name: Checkout code
6161
uses: actions/checkout@v4
6262
- name: Install postgres client

.github/workflows/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Install Go
1111
uses: actions/setup-go@v5
1212
with:
13-
go-version: 1.22.x
13+
go-version: 1.23.x
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616
- name: Run linters
@@ -21,7 +21,7 @@ jobs:
2121
go-test:
2222
strategy:
2323
matrix:
24-
go-version: [ 1.22.x ]
24+
go-version: [ 1.23.x ]
2525
platform: [ ubuntu-latest ]
2626
runs-on: ${{ matrix.platform }}
2727
steps:

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@v5
1818
with:
19-
go-version: 1.22.x
19+
go-version: 1.23.x
2020
- name: Set up Gon
2121
run: brew tap conductorone/gon && brew install conductorone/gon/gon
2222
- name: Import Keychain Certs
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Go
4444
uses: actions/setup-go@v5
4545
with:
46-
go-version: 1.22.x
46+
go-version: 1.23.x
4747
- name: Docker Login
4848
uses: docker/login-action@v1
4949
with:

.golangci.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,54 @@
1+
#AUTO GENERATED CODE. UPDATE THE CONFIG IN BATON-TEMPLATE FIRST
12
linters-settings:
23
exhaustive:
34
default-signifies-exhaustive: true
4-
55
gocritic:
6+
enabled-checks:
7+
- ruleguard
68
# The list of supported checkers can be find in https://go-critic.github.io/overview.
79
settings:
810
underef:
911
# Whether to skip (*x).method() calls where x is a pointer receiver.
1012
skipRecvDeref: false
11-
13+
ruleguard:
14+
rules: "${configDir}/tools/rules.go"
1215
govet:
1316
enable-all: true
1417
disable:
1518
- fieldalignment # too strict
1619
- shadow # complains too much about shadowing errors. All research points to this being fine.
17-
1820
nakedret:
1921
max-func-lines: 0
20-
2122
nolintlint:
22-
allow-no-explanation: [ forbidigo, tracecheck, gomnd, gochecknoinits, makezero ]
23+
allow-no-explanation: [forbidigo, tracecheck, gomnd, gochecknoinits, makezero]
2324
require-explanation: true
2425
require-specific: true
25-
2626
revive:
2727
ignore-generated-header: true
2828
severity: error
2929
rules:
3030
- name: atomic
3131
- name: line-length-limit
32-
arguments: [ 200 ]
32+
arguments: [200]
3333
# These are functions that we use without checking the errors often. Most of these can't return an error even
3434
# though they implement an interface that can.
3535
- name: unhandled-error
3636
arguments:
3737
- fmt.Printf
3838
- fmt.Println
39+
- fmt.Fprint
3940
- fmt.Fprintf
4041
- fmt.Fprintln
4142
- os.Stderr.Sync
43+
- sb.WriteString
4244
- buf.WriteString
4345
- hasher.Write
4446
- os.Setenv
4547
- os.RemoveAll
46-
- sb.WriteString
4748
- name: var-naming
4849
arguments: [["ID", "URL", "HTTP", "API"], []]
49-
5050
tenv:
5151
all: true
52-
53-
varcheck:
54-
exported-fields: false # this appears to improperly detect exported variables as unused when they are used from a package with the same name
55-
56-
5752
linters:
5853
disable-all: true
5954
enable:
@@ -71,7 +66,6 @@ linters:
7166
- durationcheck # check for two durations multiplied together
7267
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
7368
- exhaustive # check exhaustiveness of enum switch statements
74-
- exportloopref # checks for pointers to enclosing loop variables
7569
- forbidigo # Forbids identifiers
7670
- gochecknoinits # Checks that no init functions are present in Go code
7771
- goconst # Finds repeated strings that could be replaced by a constant
@@ -94,11 +88,9 @@ linters:
9488
- unconvert # Remove unnecessary type conversions
9589
- usestdlibvars # detect the possibility to use variables/constants from the Go standard library
9690
- whitespace # Tool for detection of leading and trailing whitespace
97-
9891
issues:
9992
max-same-issues: 50
100-
10193
exclude-rules:
10294
# Don't require TODO comments to end in a period
10395
- source: "(TODO)"
104-
linters: [ godot ]
96+
linters: [godot]

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ toolchain go1.24.1
66

77
require (
88
github.com/conductorone/baton-sdk v0.2.84
9+
github.com/ennyjfrick/ruleguard-logfatal v0.0.2
910
github.com/georgysavva/scany v1.2.2
1011
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
1112
github.com/jackc/pgx/v4 v4.18.3
13+
github.com/quasilyte/go-ruleguard/dsl v0.3.22
1214
github.com/spf13/viper v1.19.0
1315
go.uber.org/zap v1.27.0
1416
)

go.sum

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ github.com/doug-martin/goqu/v9 v9.19.0 h1:PD7t1X3tRcUiSdc5TEyOFKujZA5gs3VSA7wxSv
8888
github.com/doug-martin/goqu/v9 v9.19.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ=
8989
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
9090
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
91+
github.com/ennyjfrick/ruleguard-logfatal v0.0.2 h1:FlNMe9+h029VZVD8n6YdFzZAQz/aA8y6WSZttg50yBM=
92+
github.com/ennyjfrick/ruleguard-logfatal v0.0.2/go.mod h1:Ng4Cc8dzYEo8vzB2xd+IOxsO8X1OqO9mNnY4jbngQac=
9193
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
9294
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
9395
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
@@ -119,6 +121,10 @@ github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW
119121
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
120122
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
121123
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
124+
github.com/go-toolsmith/astcopy v1.0.2 h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0=
125+
github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y=
126+
github.com/go-toolsmith/astequal v1.0.3 h1:+LVdyRatFS+XO78SGV4I3TCEA0AC7fKEGma+fH+674o=
127+
github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4=
122128
github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
123129
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
124130
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
@@ -282,6 +288,14 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:Om
282288
github.com/pquerna/xjwt v0.3.0 h1:Ij21n2sUdDA1+ybybB1CAxLhSNmhsKhBnZ+UXUV+ytM=
283289
github.com/pquerna/xjwt v0.3.0/go.mod h1:Gb5PNug9MopYlFiYubUuIYPGobzVsDUKtdkJcCxEzIw=
284290
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
291+
github.com/quasilyte/go-ruleguard v0.4.4 h1:53DncefIeLX3qEpjzlS1lyUmQoUEeOWPFWqaTJq9eAQ=
292+
github.com/quasilyte/go-ruleguard v0.4.4/go.mod h1:Vl05zJ538vcEEwu16V/Hdu7IYZWyKSwIy4c88Ro1kRE=
293+
github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE=
294+
github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
295+
github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo=
296+
github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng=
297+
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs=
298+
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ=
285299
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
286300
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
287301
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -420,6 +434,8 @@ golang.org/x/crypto v0.34.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0Y
420434
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
421435
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc=
422436
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
437+
golang.org/x/exp/typeparams v0.0.0-20240213143201-ec583247a57a h1:rrd/FiSCWtI24jk057yBSfEfHrzzjXva1VkDNWRXMag=
438+
golang.org/x/exp/typeparams v0.0.0-20240213143201-ec583247a57a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
423439
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
424440
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
425441
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@@ -430,8 +446,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
430446
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
431447
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
432448
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
433-
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
434-
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
449+
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
450+
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
435451
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
436452
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
437453
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -525,8 +541,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
525541
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
526542
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
527543
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
528-
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
529-
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
544+
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
545+
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
530546
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
531547
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
532548
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

tools/rules.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build ruleguard
2+
// +build ruleguard
3+
4+
package gorules
5+
6+
import (
7+
"github.com/quasilyte/go-ruleguard/dsl"
8+
9+
logfatalrules "github.com/ennyjfrick/ruleguard-logfatal"
10+
)
11+
12+
func init() {
13+
dsl.ImportRules("logfatal", logfatalrules.Bundle) // checks for uses of log.Fatal or log.Panic
14+
}

vendor/github.com/ennyjfrick/ruleguard-logfatal/.gitignore

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/ennyjfrick/ruleguard-logfatal/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/ennyjfrick/ruleguard-logfatal/README.md

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)