Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
44 changes: 44 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: golangci-lint
on:
pull_request:
push:
branches: [master, dev]
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
Comment on lines +16 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update checkout action to latest version.

The actions/checkout action should be updated to v4 for better compatibility and security.

Apply this diff:

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
🧰 Tools
🪛 actionlint (1.7.4)

16-16: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --timeout=15m -v

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: false

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
5 changes: 1 addition & 4 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/checkout@master
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the checkout action version.

The actions/checkout@v3 action might be outdated. Consider updating to the latest version.


🌐 Web query:

What is the latest version of actions/checkout GitHub Action?

💡 Result:

The latest stable version of the actions/checkout GitHub Action is v4, as referenced across multiple sources[1][2][5][7]. This version addresses Node.js compatibility issues (deprecating Node.js 16 in favor of Node.js 20)[4][7] and includes reliability improvements for various environments[5].

For most workflows, you can implement it with:

- uses: actions/checkout@v4

Key updates in recent versions:

  • Compatibility with GitHub's updated runner environments
  • Reduced dependency on Node.js tooling[5]
  • Improved security practices for token handling[2]

Always check the official repository for new releases, as GitHub periodically updates actions to maintain compatibility with platform changes[6].

Citations:


Action Required: Update GitHub Checkout Action Version

File: .github/workflows/pre-commit.yml (Line 11)

The workflow currently uses:

      - uses: actions/checkout@v3

Based on the latest information, the current stable version of the checkout action is v4. This update addresses Node.js compatibility (switching to Node.js 20), improves security practices, and enhances overall reliability. Please update the workflow step to:

      - uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.4)

11-11: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

with:
fetch-depth: 2
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- run: go install golang.org/x/tools/cmd/goimports@latest
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0
- uses: pre-commit/[email protected]
102 changes: 48 additions & 54 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,48 @@
{
"run": {
"tests": false,
},
"linters": {
"fast": false,
"enable": [
"errcheck",
"errorlint",
"gas",
"gocritic",
"gosimple",
"govet",
"ineffassign",
"megacheck",
"misspell",
"nakedret",
"prealloc",
"revive",
"staticcheck",
"unconvert",
"unparam",
],
"disable": [
"unused",
]
},
"linters-settings": {
"revive": {
"enableAllRules": true,
"rules": [
{
"name": "var-naming",
"arguments": [
["ID"]
]
}
]
},
"gocritic": {
"enabled-tags": [
"diagnostic",
"experimental",
"opinionated",
"performance",
"style",
],
"disabled-checks": [
"hugeParam",
"unnamedResult",
]
}
},
}
run:
tests: false
skip-dirs:
- chain
- exchange
- injective_data
- proto

linters:
fast: false
enable:
- errcheck
- errorlint
- gas
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- megacheck
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unparam
disable:
- unused

linters-settings:
revive:
enableAllRules: true
rules:
- name: var-naming
arguments:
- ["ID"]
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- hugeParam
- unnamedResult
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,3 @@ repos:
- id: end-of-file-fixer
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/dnephin/pre-commit-golang
rev: master
hooks:
- id: go-fmt
- id: go-imports
- id: golangci-lint
args: [--timeout=15m]
Loading