Conversation
WalkthroughThis PR updates Go linting configuration to enable additional linters and reorganize rules structure, removes unused SDK-specific type definitions from upgrade tests, and adds clarifying comments to escrow payment closure handling without altering functionality. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| - unconvert | ||
| - unparam | ||
| - unused | ||
| settings: |
There was a problem hiding this comment.
that part has wrong indentation
| .PHONY: lint-go | ||
| lint-go: $(GOLANGCI_LINT) | ||
| $(GOLANGCI_LINT_RUN) ./... --issues-exit-code=0 --timeout=10m | ||
| $(GOLANGCI_LINT) run ./... --timeout=10m |
There was a problem hiding this comment.
Lets fail in case of linter errors
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.golangci.yaml:
- Around line 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.
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ |
There was a problem hiding this comment.
🧩 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:
golangci-lint path exclusion pattern syntax glob regex
💡 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)
run.skip-dirs, run.skip-files
These accept regexp patterns (matched against the path; commonly treated as “full path”). Example patterns like (^|/)vendor($|/) are used to skip directories. (github.com)
linters.exclusions.paths, linters.exclusions.rules[*].path, path-except
These are used to exclude reported issues by path, and the examples in the docs are clearly regex (e.g. (.+)_test\.go, _test\.go). (golangci-lint.run)
Relative path base (run.relative-path-mode)
What the regex is matched against depends on how golangci-lint computes “relative paths” (e.g. relative to go.mod, git root, config file, or working dir). (golangci-lint.run)
Glob (only where explicitly documented)
Some linter settings explicitly say they accept glob patterns. For example:
ruleguard.rules: “Glob patterns such asrules-*.gomay be specified.” (golangci-lint.run)protogetter.skip-files: “Skip files matching the specified glob pattern…” (examples include*.pb.go,*/vendor/*). (golangci-lint.run)
Practical takeaway
- If you’re configuring run skips or issue exclusions by path: write regex (RE2/Go-style), e.g.
.*_test\.go$,(^|/)vendor($|/). (golangci-lint.run) - If you want glob, use only the options that explicitly document glob support (typically linter-specific settings). (golangci-lint.run)
Citations:
- 1: skip-dirs golangci/golangci-lint#2378
- 2: https://golangci-lint.run/docs/linters/false-positives/?utm_source=openai
- 3: https://golangci-lint.run/docs/configuration/file/
- 4: https://golangci-lint.run/docs/linters/configuration/?utm_source=openai
- 5: https://golangci-lint.run/docs/linters/configuration/?utm_source=openai
- 6: https://golangci-lint.run/docs/linters/false-positives/?utm_source=openai
- 7: https://golangci-lint.run/docs/linters/configuration/?utm_source=openai
🏁 Script executed:
# Read the .golangci.yaml file to see the context around lines 42-45
cat -n .golangci.yaml | sed -n '30,50p'Repository: akash-network/node
Length of output: 629
🏁 Script executed:
# Properly search for the directories mentioned
find . -type d \( -name "third_party" -o -name "builtin" -o -name "examples" \) 2>/dev/nullRepository: akash-network/node
Length of output: 44
🏁 Script executed:
# Check if there are any Go files in these directories (if they exist)
find . -type f -name "*.go" -path "*/third_party/*" -o -name "*.go" -path "*/builtin/*" -o -name "*.go" -path "*/examples/*" 2>/dev/null | head -20Repository: akash-network/node
Length of output: 44
🏁 Script executed:
# Let's check the golangci-lint documentation more carefully
# Look for any comments or documentation in the repo about these patterns
grep -r "third_party\|builtin\|examples" .golangci.yamlRepository: akash-network/node
Length of output: 173
🌐 Web query:
golangci-lint exclusions paths regex pattern matching behavior
💡 Result:
In golangci-lint, “exclusion paths” (e.g. linters.exclusions.paths, linters.exclusions.rules[].path, path-except) are treated as Go regular expressions (RE2) and are matched against the file path string (not glob patterns). (golangci-lint.run)
Key behavior:
- What string is matched: the (relative) file path for the issue/file; patterns like
(.+)_test\.gowork because the matcher sees the path text. (golangci-lint.run) - Relative-to what? Controlled by
run.relative-path-mode(used by exclusions, among other things). Options:gomod,gitroot,cfg, orwd(not recommended). Default iscfgin config v2. (golangci-lint.run) - Path separators:
/in patterns is treated portably (documented as being replaced by the OS path separator) so patterns can work on Windows too. (golangci-lint.run) - Not implicitly anchored: regexes match like normal RE2—if you want “whole path” matching, add
^...$yourself; if you want “directory only”, use an explicit boundary (e.g.(^|.*/)generated(/|$)).
Legacy note (v1 docs / older configs): exclusions were described as matching paths relative to the current working directory, and --path-prefix could affect matching. (golangci.github.io)
Citations:
- 1: https://golangci-lint.run/docs/linters/false-positives/?utm_source=openai
- 2: https://golangci-lint.run/docs/linters/false-positives/?utm_source=openai
- 3: https://golangci-lint.run/docs/configuration/file/
- 4: https://golangci-lint.run/docs/configuration/file/
- 5: https://golangci.github.io/legacy-v1-doc/usage/false-positives/?utm_source=openai
🏁 Script executed:
# Check if there's a go.mod or any indication of project structure
head -20 go.mod 2>/dev/null || echo "No go.mod found in expected location"Repository: akash-network/node
Length of output: 573
Path exclusion patterns use regex and won't exclude files within these directories.
The patterns third_party$, builtin$, examples$ are Go regular expressions (not glob). The $ anchor matches only the end of the path string. A path like third_party/somefile.go ends with .go, not third_party, so it won't be excluded.
If the intent is to exclude all files within these directories, adjust the patterns to:
🔧 Suggested fix
paths:
- - third_party$
- - builtin$
- - examples$
+ - third_party/
+ - builtin/
+ - examples/📝 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.
| 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.
Description
Issues:
--issues-exit-code=0flag was used, which causes silent fails.Changes
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.md