Skip to content

Commit 1dc8af2

Browse files
committed
updarte golangci-lint to v2
1 parent 38a9bf8 commit 1dc8af2

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ jobs:
6767
run: go install honnef.co/go/tools/cmd/staticcheck@2025.1.1
6868

6969
- name: Install golangci-lint
70-
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
71-
72-
# - name: Install NilAway
73-
# run: go install go.uber.org/nilaway/cmd/nilaway@v0.0.0-20240821220108-c91e71c080b7
70+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.2
7471

7572
- name: Lint
7673
run: make lint

.golangci.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
version: "2"
12
linters:
23
enable-all: true
34
disable:
45
- cyclop
56
- forbidigo
67
- funlen
7-
- gci
88
- gochecknoglobals
99
- gochecknoinits
1010
- gocritic
@@ -39,7 +39,6 @@ linters:
3939
#
4040
# Disabled because deprecated:
4141
#
42-
- tenv
4342

4443
linters-settings:
4544
#
@@ -87,3 +86,19 @@ linters-settings:
8786
- 'MockBeaconClient'
8887
- 'RelayAPI'
8988
- 'Webserver'
89+
90+
formatters:
91+
enable:
92+
- gci
93+
- gofmt
94+
- gofumpt
95+
- goimports
96+
settings:
97+
gofumpt:
98+
extra-rules: true
99+
exclusions:
100+
generated: lax
101+
paths:
102+
- third_party$
103+
- builtin$
104+
- examples$

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- Go version: 1.24 (see `go.mod`). Module path: `github.com/flashbots/go-template`.
88

99
## Build, Test, and Development Commands
10+
- Use tab instead of spaces for indentation.
11+
- Always run `make fmt` and `make lint` and `make test` before committing.
1012
- `make build`: builds CLI and HTTP server into `build/`.
1113
- `make build-cli` / `make build-httpserver`: build individual binaries.
1214
- `make lint`: run formatters and linters (`gofmt`, `gofumpt`, `go vet`, `staticcheck`, `golangci-lint`).

database/database.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ func NewDatabaseService(dsn string) (*DatabaseService, error) {
2121
return nil, err
2222
}
2323

24-
db.DB.SetMaxOpenConns(50)
25-
db.DB.SetMaxIdleConns(10)
26-
db.DB.SetConnMaxIdleTime(0)
24+
db.SetMaxOpenConns(50)
25+
db.SetMaxIdleConns(10)
26+
db.SetConnMaxIdleTime(0)
2727

2828
if os.Getenv("DB_DONT_APPLY_SCHEMA") == "" {
2929
migrate.SetTable(vars.TableMigrations)

httpserver/handler_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func Test_Handlers_Healthcheck_Drain_Undrain(t *testing.T) {
4040
w := httptest.NewRecorder()
4141
s.handleReadinessCheck(w, req)
4242
resp := w.Result()
43-
defer resp.Body.Close()
43+
defer resp.Body.Close() //nolint:errcheck
4444
_, err := io.ReadAll(resp.Body)
4545
require.NoError(t, err)
4646
require.Equal(t, http.StatusOK, resp.StatusCode, "Healthcheck must return `Ok` before draining")
@@ -53,7 +53,7 @@ func Test_Handlers_Healthcheck_Drain_Undrain(t *testing.T) {
5353
s.handleDrain(w, req)
5454
duration := time.Since(start)
5555
resp := w.Result()
56-
defer resp.Body.Close()
56+
defer resp.Body.Close() //nolint:errcheck
5757
_, err := io.ReadAll(resp.Body)
5858
require.NoError(t, err)
5959
require.Equal(t, http.StatusOK, resp.StatusCode, "Must return `Ok` for calls to `/drain`")
@@ -65,7 +65,7 @@ func Test_Handlers_Healthcheck_Drain_Undrain(t *testing.T) {
6565
w := httptest.NewRecorder()
6666
s.handleReadinessCheck(w, req)
6767
resp := w.Result()
68-
defer resp.Body.Close()
68+
defer resp.Body.Close() //nolint:errcheck
6969
_, err := io.ReadAll(resp.Body)
7070
require.NoError(t, err)
7171
require.Equal(t, http.StatusServiceUnavailable, resp.StatusCode, "Healthcheck must return `Service Unavailable` after draining")
@@ -76,7 +76,7 @@ func Test_Handlers_Healthcheck_Drain_Undrain(t *testing.T) {
7676
w := httptest.NewRecorder()
7777
s.handleUndrain(w, req)
7878
resp := w.Result()
79-
defer resp.Body.Close()
79+
defer resp.Body.Close() //nolint:errcheck
8080
_, err := io.ReadAll(resp.Body)
8181
require.NoError(t, err)
8282
require.Equal(t, http.StatusOK, resp.StatusCode, "Must return `Ok` for calls to `/undrain`")
@@ -88,7 +88,7 @@ func Test_Handlers_Healthcheck_Drain_Undrain(t *testing.T) {
8888
w := httptest.NewRecorder()
8989
s.handleReadinessCheck(w, req)
9090
resp := w.Result()
91-
defer resp.Body.Close()
91+
defer resp.Body.Close() //nolint:errcheck
9292
_, err := io.ReadAll(resp.Body)
9393
require.NoError(t, err)
9494
require.Equal(t, http.StatusOK, resp.StatusCode, "Healthcheck must return `Ok` after undraining")

0 commit comments

Comments
 (0)