feat: add .golangci.yml configuration with a curated set of linters#364
Draft
SuperCoolPencil wants to merge 2 commits intomainfrom
Draft
feat: add .golangci.yml configuration with a curated set of linters#364SuperCoolPencil wants to merge 2 commits intomainfrom
SuperCoolPencil wants to merge 2 commits intomainfrom
Conversation
| # style / quality | ||
| - gocritic | ||
| - revive | ||
| - goconst No newline at end of file |
Contributor
There was a problem hiding this comment.
Missing newline at end of file
The file is missing a trailing newline (\ No newline at end of file in the diff). This violates POSIX conventions and can cause issues with tools that process the config (e.g., shell scripts, cat output, and some CI parsers). Add a newline after the last line.
Suggested change
| - goconst | |
| - goconst |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .golangci.yml
Line: 36
Comment:
**Missing newline at end of file**
The file is missing a trailing newline (`\ No newline at end of file` in the diff). This violates POSIX conventions and can cause issues with tools that process the config (e.g., shell scripts, `cat` output, and some CI parsers). Add a newline after the last line.
```suggestion
- goconst
```
How can I resolve this? If you propose a fix, please make it concise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR introduces a
.golangci.ymlgolangci-lint v2 configuration with a curated set of ~20 linters (correctness, performance, resource safety, and style), and simultaneously fixes all existing violations across 47 files. The fixes are mechanical:fmt.Errorfwith static strings →errors.New, direct error equality →errors.Is, string literal HTTP method/status constants →http.Method*/http.Status*,fmt.Sprintffor simple string/int formatting → concatenation orstrconv.Confidence Score: 5/5
Safe to merge — all changes are mechanical linter-driven fixes with no behavioral impact.
All findings are P2 style suggestions (missing EOF newline, auto-generated variable name). No logic changes, no new error paths, no functional regressions introduced.
.golangci.yml(missing trailing newline) andinternal/download/manager_test.go(odd auto-generated variable namelongNameSb651).Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[golangci-lint runs on CI] --> B{Linter checks} B --> C[correctness\nstaticcheck · govet · errcheck\nunused · ineffassign · errorlint\ncontextcheck · nilerr · makezero] B --> D[performance\nprealloc · perfsprint\nusestdlibvars] B --> E[resource safety\nbodyclose · noctx · sqlclosecheck\nrowserrcheck · gosec] B --> F[style / quality\ngocritic · revive · goconst] C --> G[Fixed: errors.New · errors.Is\nhttp.Method* constants] D --> H[Fixed: strconv · string concat\nstrings.Builder] E --> I[Fixed: bodyclose · noctx patterns] F --> J[Fixed: comment spacing\nif→switch · blank lines]Comments Outside Diff (1)
internal/download/manager_test.go, line 725-731 (link)longNameSb651is a machine-generated name that's hard to read. Additionally, the wholestrings.Builderloop can be replaced with the idiomaticstrings.Repeat, which is clearer and already in the stdlib per the project's preference for built-in functions.(Remove the loop, the
strings.Buildervariable, and thelongName += longNameSb651.String()andlongName += ".txt"lines below it.)Rule Used: What: Prefer built-in or existing library function... (source)
Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "automatically attempy to fix issues by u..." | Re-trigger Greptile