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/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
go_version: '~1.22.10'
go_version: '~1.24.9'

jobs:
Build:
Expand All @@ -30,9 +30,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: golangci/golangci-lint-action@v6
- uses: golangci/golangci-lint-action@v7
with:
version: v1.62.2
version: v2.5.0
check_mockgen:
name: Up-to-date mocks
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/create-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ jobs:
with:
push: true
tags: avaplatform/avalanche-rosetta:${{ steps.get_version.outputs.VERSION }}
build-args: |
AVALANCHE_VERSION=v1.14.0
ROS_COMMIT=${{ github.sha }}
300 changes: 145 additions & 155 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# https://golangci-lint.run/usage/configuration/
version: "2"
run:
timeout: 10m

# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
skip-dirs-use-default: false

# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand All @@ -18,12 +14,9 @@ run:
#
# Allowed values: readonly|vendor|mod
# By default, it isn't set.
modules-download-mode: readonly
modules-download-mode: mod
tests: false

output:
# Make issues output unique by line.
# Default: true
uniq-by-line: false

issues:
# Maximum issues count per one linter.
Expand All @@ -37,175 +30,172 @@ issues:
max-same-issues: 0

linters:
disable-all: true
default: none
enable:
- asciicheck
- bodyclose
- depguard
# - depguard
- dupword
- errcheck
# - errcheck
- errorlint
- exportloopref
- forbidigo
- gci
# - exportloopref
# - forbidigo
# - gci
- goconst
- gocritic
# - goerr113
- gofmt
- gofumpt
# - gofmt
# - gofumpt
# - gomnd
- goprintffuncname
- gosec
- gosimple
# - gosec
# - gosimple
- govet
- importas
- ineffassign
# - lll
- misspell
- nakedret
- noctx
# - noctx
- nolintlint
- perfsprint
- prealloc
- predeclared
- revive
# - revive
- spancheck
- staticcheck
- stylecheck
# - staticcheck
# - stylecheck
- tagalign
- testifylint
- typecheck
# - typecheck
- unconvert
- unparam
- unused
# - unused
- usestdlibvars
- whitespace

linters-settings:
depguard:
rules:
packages:
deny:
- pkg: "io/ioutil"
desc: io/ioutil is deprecated. Use package io or os instead.
- pkg: "github.com/stretchr/testify/assert"
desc: github.com/stretchr/testify/require should be used instead.
- pkg: "github.com/golang/mock/gomock"
desc: go.uber.org/mock/gomock should be used instead.
errorlint:
# Check for plain type assertions and type switches.
asserts: false
# Check for plain error comparisons.
comparison: false
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
- 'require\.Error$(# ErrorIs should be used instead)?'
- 'require\.ErrorContains$(# ErrorIs should be used instead)?'
- 'require\.EqualValues$(# Equal should be used instead)?'
- 'require\.NotEqualValues$(# NotEqual should be used instead)?'
- '^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?'
# Exclude godoc examples from forbidigo checks.
exclude_godoc_examples: false
gci:
sections:
- standard
- default
- blank
- dot
- prefix(github.com/ava-labs/avalanche-rosetta)
- alias
skip-generated: true
custom-order: true
gosec:
excludes:
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
- G115 # TODO: use typesafe conversion for uint64 -> int64
importas:
# Do not allow unaliased imports of aliased packages.
no-unaliased: false
# Do not allow non-required aliases.
no-extra-aliases: false
# List of aliases
alias:
- pkg: github.com/ava-labs/coreth/core/types
alias: ethtypes
- pkg: github.com/ethereum/go-ethereum/common
alias: ethcommon
- pkg: github.com/ava-labs/avalanche-rosetta/mapper/pchain
alias: pmapper
- pkg: github.com/ava-labs/avalanche-rosetta/mapper/cchainatomictx
alias: cmapper
- pkg: github.com/ava-labs/avalanchego/utils/constants
alias: avaconstants
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
- name: bool-literal-in-expr
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
- name: early-return
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
- name: empty-lines
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
- name: string-format
disabled: false
arguments:
- ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
- name: unexported-naming
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
- name: unhandled-error
disabled: false
arguments:
- "fmt\\.Fprint"
- "fmt\\.Fprintf"
- "fmt\\.Print"
- "fmt\\.Printf"
- "fmt\\.Println"
- "math/rand\\.Read"
- "strings\\.Builder\\.WriteString"
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
- name: unused-receiver
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
disabled: false
spancheck:
# https://github.com/jjti/go-spancheck#checks
checks:
- end
# - record-error # check that `span.RecordError(err)` is called when an error is returned
# - set-status # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned
staticcheck:
# https://staticcheck.io/docs/options#checks
checks:
- "all"
- "-SA6002" # Storing non-pointer values in sync.Pool allocates memory
- "-SA1019" # Using a deprecated function, variable, constant or field
tagalign:
align: true
sort: true
strict: true
order:
- serialize
testifylint:
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
# Default: false
enable-all: true
# Disable checkers by name
# (in addition to default
# suite-thelper
# ).
disable:
- go-require
- float-compare
settings:
depguard:
rules:
packages:
deny:
- pkg: "io/ioutil"
desc: io/ioutil is deprecated. Use package io or os instead.
- pkg: "github.com/stretchr/testify/assert"
desc: github.com/stretchr/testify/require should be used instead.
- pkg: "github.com/golang/mock/gomock"
desc: go.uber.org/mock/gomock should be used instead.
errorlint:
# Check for plain type assertions and type switches.
asserts: false
# Check for plain error comparisons.
comparison: false
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
- pattern: 'require\.Error$(# ErrorIs should be used instead)?'
- pattern: 'require\.ErrorContains$(# ErrorIs should be used instead)?'
- pattern: 'require\.EqualValues$(# Equal should be used instead)?'
- pattern: 'require\.NotEqualValues$(# NotEqual should be used instead)?'
- pattern: '^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?'
# gci:
# sections:
# - standard
# - default
# - blank
# - dot
# - prefix(github.com/ava-labs/avalanche-rosetta)
# - alias
# skip-generated: true
# custom-order: true
gosec:
excludes:
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
- G115 # TODO: use typesafe conversion for uint64 -> int64
importas:
# Do not allow unaliased imports of aliased packages.
no-unaliased: false
# Do not allow non-required aliases.
no-extra-aliases: false
# List of aliases
alias:
- pkg: github.com/ava-labs/libevm/core/types
alias: ethtypes
- pkg: github.com/ethereum/go-ethereum/common
alias: ethcommon
- pkg: github.com/ava-labs/avalanche-rosetta/mapper/pchain
alias: pmapper
- pkg: github.com/ava-labs/avalanche-rosetta/mapper/cchainatomictx
alias: cmapper
- pkg: github.com/ava-labs/avalanchego/utils/constants
alias: avaconstants
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
- name: bool-literal-in-expr
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
- name: early-return
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
- name: empty-lines
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
- name: string-format
disabled: false
arguments:
- ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
- name: unexported-naming
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
- name: unhandled-error
disabled: false
arguments:
- "fmt\\.Fprint"
- "fmt\\.Fprintf"
- "fmt\\.Print"
- "fmt\\.Printf"
- "fmt\\.Println"
- "math/rand\\.Read"
- "strings\\.Builder\\.WriteString"
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
- name: unused-receiver
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
disabled: false
spancheck:
# https://github.com/jjti/go-spancheck#checks
checks:
- end
# - record-error # check that `span.RecordError(err)` is called when an error is returned
# - set-status # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned
staticcheck:
# https://staticcheck.io/docs/options#checks
checks:
- "all"
- "-SA6002" # Storing non-pointer values in sync.Pool allocates memory
- "-SA1019" # Using a deprecated function, variable, constant or field
tagalign:
align: true
sort: true
strict: true
order:
- serialize
testifylint:
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
# Default: false
enable-all: true
# Disable checkers by name
# (in addition to default
# suite-thelper
# ).
disable:
- go-require
- float-compare
Loading