Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(store): Better syntax (merge after go 1.23 release) #112

Merged
merged 8 commits into from
Sep 25, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
args: ["build", "lint", "test"]
os: [ubuntu-latest]
go-version: [1.21.0]
go-version: [1.23.1]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
10 changes: 3 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ run:
# Default: 1m
timeout: 3m


# This file contains only configs which differ from defaults.
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
linters-settings:
Expand Down Expand Up @@ -96,7 +95,6 @@ linters-settings:
# Default: 40
statements: 50


gci:
sections:
- standard # Standard section: captures all standard packages.
Expand Down Expand Up @@ -130,7 +128,7 @@ linters-settings:
# Default: true
skipRecvDeref: false

gomnd:
mnd:
# List of function patterns to exclude from analysis.
# Values always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
Expand Down Expand Up @@ -179,7 +177,7 @@ linters-settings:
nolintlint:
# Exclude following linters from requiring an explanation.
# Default: []
allow-no-explanation: [ funlen, gocognit, lll ]
allow-no-explanation: [funlen, gocognit, lll]
# Enable to require an explanation of nonzero length after each nolint directive.
# Default: false
require-explanation: true
Expand Down Expand Up @@ -221,9 +219,7 @@ linters:
- durationcheck # checks for two durations multiplied together
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- execinquery # checks query string in Query function which reads your Go src files and warning it finds
- exhaustive # checks exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- forbidigo # forbids identifiers
- funlen # tool for detection of long functions
- gci # controls golang package import order and makes it always deterministic
Expand All @@ -236,7 +232,7 @@ linters:
- godot # checks if comments end in a period
- goheader # checks is file header matches to pattern
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- gomnd # detects magic numbers
- mnd # detects magic numbers
# - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
# - gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
- goprintffuncname # checks that printf-like functions are named with f at the end
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ generate: |
go generate ./...

tidy: |
go mod tidy
go mod tidy
2 changes: 1 addition & 1 deletion baseapp/job_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewManager(
// TODO: read pool configs from the config file.

// Setup the producer worker pool.
jobCount := uint16(m.jobRegistry.Count())
jobCount := uint16(m.jobRegistry.Count()) //nolint:gosec // safe to convert.
m.producerCfg = &worker.PoolConfig{
Name: producerName,
PrometheusPrefix: producerPromName,
Expand Down
4 changes: 3 additions & 1 deletion core/transactor/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (t *TxrV2) retrieveBatch(ctx context.Context) types.Requests {
}

// Get at most txsRemaining tx requests from the queue.
msgIDs, txReqs, err := t.requests.ReceiveMany(int32(txsRemaining))
msgIDs, txReqs, err := t.requests.ReceiveMany(
int32(txsRemaining), //nolint:gosec // safe to convert.
)
if err != nil {
t.logger.Error("failed to receive tx request", "err", err)
continue
Expand Down
4 changes: 2 additions & 2 deletions core/transactor/sender/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
)

var (
multiplier = big.NewInt(11500) //nolint:gomnd // its okay.
quotient = big.NewInt(10000) //nolint:gomnd // its okay.
multiplier = big.NewInt(11500) //nolint:mnd // its okay.
quotient = big.NewInt(10000) //nolint:mnd // its okay.
)

// BumpGas bumps the gas on a tx by a 15% increase.
Expand Down
2 changes: 1 addition & 1 deletion core/transactor/transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (t *TxrV2) Execute(context.Context, any) (any, error) {
"🧠 system status",
"waiting-tx", acquired, "in-flight-tx", inFlight, "pending-requests", t.requests.Len(),
)
return nil, nil //nolint:nilnil // its okay.
return 1, nil
}

// IntervalTime implements job.Polling.
Expand Down
Loading
Loading