-
Notifications
You must be signed in to change notification settings - Fork 262
fix: linter issues #2038
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
base: main
Are you sure you want to change the base?
fix: linter issues #2038
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,40 +1,63 @@ | ||||||||||||||||||
| --- | ||||||||||||||||||
| version: "2" | ||||||||||||||||||
| issues: | ||||||||||||||||||
| max-issues-per-linter: 1000 | ||||||||||||||||||
| max-same-issues: 1000 | ||||||||||||||||||
| linters: | ||||||||||||||||||
| default: none | ||||||||||||||||||
| enable: | ||||||||||||||||||
| - bodyclose | ||||||||||||||||||
| - copyloopvar | ||||||||||||||||||
| - cyclop | ||||||||||||||||||
| - errcheck | ||||||||||||||||||
| - errchkjson | ||||||||||||||||||
| - errorlint | ||||||||||||||||||
| - goconst | ||||||||||||||||||
| - gocritic | ||||||||||||||||||
| - gosec | ||||||||||||||||||
| - govet | ||||||||||||||||||
| - ineffassign | ||||||||||||||||||
| - misspell | ||||||||||||||||||
| - nilerr | ||||||||||||||||||
| - nilnil | ||||||||||||||||||
| - noctx | ||||||||||||||||||
| # - nolintlint # very good linter, but there are 109 issues to solve | ||||||||||||||||||
| - prealloc | ||||||||||||||||||
| - revive | ||||||||||||||||||
| - staticcheck | ||||||||||||||||||
| - unconvert | ||||||||||||||||||
| - unparam | ||||||||||||||||||
| - unused | ||||||||||||||||||
| settings: | ||||||||||||||||||
| gocritic: | ||||||||||||||||||
| disabled-checks: | ||||||||||||||||||
| - ifElseChain | ||||||||||||||||||
| - singleCaseSwitch | ||||||||||||||||||
| exclusions: | ||||||||||||||||||
| generated: lax | ||||||||||||||||||
| presets: | ||||||||||||||||||
| - comments | ||||||||||||||||||
| - common-false-positives | ||||||||||||||||||
| - legacy | ||||||||||||||||||
| - std-error-handling | ||||||||||||||||||
| rules: | ||||||||||||||||||
| - path: (.+)\.go$ | ||||||||||||||||||
| text: comment on exported (method|function|type|const|var) | ||||||||||||||||||
| paths: | ||||||||||||||||||
| - third_party$ | ||||||||||||||||||
| - builtin$ | ||||||||||||||||||
| - examples$ | ||||||||||||||||||
| - wastedassign | ||||||||||||||||||
| exclusions: | ||||||||||||||||||
| generated: lax | ||||||||||||||||||
| presets: | ||||||||||||||||||
| - comments | ||||||||||||||||||
| - common-false-positives | ||||||||||||||||||
| - legacy | ||||||||||||||||||
| - std-error-handling | ||||||||||||||||||
| rules: | ||||||||||||||||||
| - path: (.+)\.go$ | ||||||||||||||||||
| text: comment on exported (method|function|type|const|var) | ||||||||||||||||||
| paths: | ||||||||||||||||||
| - third_party$ | ||||||||||||||||||
| - builtin$ | ||||||||||||||||||
| - examples$ | ||||||||||||||||||
|
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, locate and examine the .golangci.yaml file
find . -name ".golangci.yaml" -o -name ".golangci.yml" | head -5Repository: akash-network/node Length of output: 78 🏁 Script executed: # Check if the directories mentioned exist
fd -t d -name "third_party" -o -name "builtin" -o -name "examples" | head -10Repository: akash-network/node Length of output: 292 🌐 Web query:
💡 Result: In golangci-lint, “path exclusion patterns” are usually regular expressions (regex), not glob—but a few linter-specific settings explicitly use glob. Regex (most common)
|
||||||||||||||||||
| paths: | |
| - third_party$ | |
| - builtin$ | |
| - examples$ | |
| paths: | |
| - third_party/ | |
| - builtin/ | |
| - examples/ |
🤖 Prompt for AI Agents
In @.golangci.yaml around lines 42 - 45, The path exclusion patterns
`third_party$`, `builtin$`, and `examples$` are regexes anchored to the very end
of the path so they won't match files inside those directories (e.g.,
`third_party/somefile.go`); update those patterns to match directory prefixes
instead (for example use patterns that start with the directory name and allow a
trailing slash or any following path segment such as `^third_party(/|$)`,
`^builtin(/|$)`, `^examples(/|$)` or `^third_party/.*`, `^builtin/.*`,
`^examples/.*`) so that the `paths:` entries will correctly exclude all files
under those directories.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,6 @@ | ||
| SUBLINTERS = unused \ | ||
| misspell \ | ||
| gofmt \ | ||
| gocritic \ | ||
| goconst \ | ||
| ineffassign \ | ||
| unparam \ | ||
| staticcheck \ | ||
| revive \ | ||
| gosec \ | ||
| exportloopref \ | ||
| prealloc | ||
| # TODO: ^ gochecknoglobals | ||
|
|
||
| .PHONY: lint-go | ||
| lint-go: $(GOLANGCI_LINT) | ||
| $(GOLANGCI_LINT_RUN) ./... --issues-exit-code=0 --timeout=10m | ||
| $(GOLANGCI_LINT) run ./... --timeout=10m | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets fail in case of linter errors |
||
|
|
||
| .PHONY: lint-go-% | ||
| lint-go-%: $(GOLANGCI_LINT) | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that part has wrong indentation