Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/go-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.23'
- run: go mod tidy
- uses: golangci/golangci-lint-action@v6
- uses: golangci/golangci-lint-action@v7
with:
version: 'v1.61'
version: 'v2.1.5'
- run: go build -v ./...
- run: go test -v ./...
244 changes: 130 additions & 114 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,138 @@
run:
timeout: 10m

version: "2"
linters:
presets:
- bugs
- error
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- durationcheck
- fatcontext
- gochecksumtype
- gocritic
- gosec
- gosmopolitan
- loggercheck
- nilnesserr
- prealloc
- protogetter
- reassign
- recvcheck
- rowserrcheck
- spancheck
- sqlclosecheck
- testifylint
- unconvert
- zerologlint
- makezero
- noctx
- nilerr
- errorlint
- unused
- performance
disable:
- exhaustive
- musttag
- contextcheck
- wrapcheck
- goerr113
- unparam
- makezero #TODO: enable me
- noctx #TODO: enable me
- nilerr #TODO: enable me
- errorlint #TODO: enable me
- errchkjson #TODO: enable me
- unused #TODO: enable me
- perfsprint #TODO: enable me
- contextcheck
- err113
- exhaustive
- gocheckcompilerdirectives
- musttag
- unparam
- wrapcheck
settings:
goconst:
min-len: 2
min-occurrences: 2
gocritic:
disabled-checks:
- rangeValCopy
- exitAfterDefer
- elseif
- dupBranchBody
- assignOp
- singleCaseSwitch
- captLocal
- commentFormatting
- ifElseChain
- sprintfQuotedString
- commentedOutCode
- preferFprint
- importShadow
- emptyStringTest
- paramTypeCombine
- unnamedResult
enabled-tags:
- performance
- diagnostic
- style
settings:
rangeExprCopy:
sizeThreshold: 512
skipTestFuncs: true
underef:
skipRecvDeref: true
govet:
disable:
- deepequalerrors
- fieldalignment
- shadow
- unsafeptr
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- golint
text: should be
- linters:
- errcheck
text: not checked
- linters:
- staticcheck
text: SA(1019|1029|5011)
- linters:
- gocritic
- gosec
- unused
path: test\.go
- linters:
- gocritic
- gosec
- unused
path: hack\.go
- linters:
- gocritic
- gosec
- unused
path: cmd/devp2p
- linters:
- gocritic
- gosec
path: metrics/sample\.go
- linters:
- gocritic
- gosec
path: p2p/simulations
- linters:
- gocritic
- gosec
path: p2p/dnsdisc
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- unconvert
# - predeclared #TODO: enable me
# - thelper #TODO: enable me
# - wastedassign
- gofmt
- gocritic
# - revive
# - forcetypeassert
# - stylecheck

linters-settings:
gocritic: # see https://golangci-lint.run/usage/linters/#gocritic and https://go-critic.github.io/overview#checks-overview
enabled-tags:
- performance
- diagnostic
- style
disabled-checks:
- rangeValCopy
- exitAfterDefer
- elseif
- dupBranchBody
- assignOp
- singleCaseSwitch
- captLocal
- commentFormatting
- ifElseChain
- sprintfQuotedString
- commentedOutCode
- preferFprint

# style tag
- importShadow
- emptyStringTest
- paramTypeCombine
- unnamedResult

settings:
rangeExprCopy:
# size in bytes that makes the warning trigger (default 512)
sizeThreshold: 512
# whether to check test functions (default true)
skipTestFuncs: true
underef:
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
skipRecvDeref: true

govet:
disable:
- deepequalerrors
- fieldalignment
- shadow
- unsafeptr
goconst:
min-len: 2
min-occurrences: 2
gofmt:
simplify: false

issues:
exclude-rules:
- linters:
- golint
text: "should be"
- linters:
- errcheck
text: "not checked"
- linters:
- staticcheck
text: "SA(1019|1029|5011)"
# Exclude some linters from running on tests files.
- path: test\.go
linters:
- gosec
- unused
- gocritic
- path: hack\.go
linters:
- gosec
- unused
- gocritic
- path: cmd/devp2p
linters:
- gosec
- unused
- gocritic
- path: metrics/sample\.go
linters:
- gosec
- gocritic
- path: p2p/simulations
linters:
- gosec
- gocritic
- path: p2p/dnsdisc
linters:
- gosec
- gocritic
settings:
gofmt:
simplify: false
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ lintci:
## lintci-deps: (re)installs golangci-lint to build/bin/golangci-lint
lintci-deps:
rm -f ./build/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.57.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v2.1.5

.PHONY: build test run clean
3 changes: 2 additions & 1 deletion cmd/diagnostics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bufio"
"context"
"errors"
"fmt"
"log"
"net/http"
Expand Down Expand Up @@ -72,7 +73,7 @@ func main() {
switch s := <-signalCh; s {
case syscall.SIGTERM:
log.Println("Terminating gracefully.")
if err := srv.Shutdown(context.Background()); err != http.ErrServerClosed {
if err := srv.Shutdown(context.Background()); !errors.Is(err, http.ErrServerClosed) {
log.Println("Failed to shutdown server:", err)
}
case syscall.SIGINT:
Expand Down
4 changes: 2 additions & 2 deletions internal/erigon_node/remote_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ func (rc *RemoteCursor) findFullDbPath(ctx context.Context, db string) (string,
request, err := rc.nodeClient.fetch(ctx, "dbs", nil)

if err != nil {
return "", fmt.Errorf("unable to fetch database list: %s", err)
return "", fmt.Errorf("unable to fetch database list: %w", err)
}

_, result, err := request.nextResult(ctx)

if err != nil {
return "", fmt.Errorf("unable to fetch database list: %s", err)
return "", fmt.Errorf("unable to fetch database list: %w", err)
}

var lines []string
Expand Down
18 changes: 0 additions & 18 deletions internal/sessions/helpers.go

This file was deleted.

4 changes: 0 additions & 4 deletions internal/sessions/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import (
"net/http"
)

const sessionIdCookieName = "sessionId"

const sessionIdCookieDuration = 30 * 24 * 3600 // 30 days

type Middleware struct {
CacheService
}
Expand Down