Consider enabling disabled linters (gosec, staticcheck, errcheck, errname, misspell)
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 17.3k
- Forks
- 1.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 105
Description
问题描述
在 .golangci.yml 中,有 5 个推荐的 linter 被注释禁用,注释为 "To enable later after fixing existing issues":
- errcheck - checks for unchecked errors
- errname - checks that error types are named XxxError
- gosec - security-oriented linter
- misspell - finds commonly misspelled English words
- staticcheck - comprehensive static analysis
启用这些 linter 的好处
| Linter | 好处 |
|---|---|
| errcheck | 捕获未检查的错误返回值,可能导致忽略重要的错误条件 |
| errname | 确保错误类型命名规范(XxxError),提高错误处理的代码可读性 |
| gosec | 扫描安全问题,如硬编码凭证、不安全的随机数、SQL 注入等 |
| misspell | 捕获拼写错误,提高文档和代码注释的质量 |
| staticcheck | 综合静态分析,发现潜在的 bug、性能问题和代码风格问题 |
建议
建议创建一个跟踪 issue 或里程碑来记录启用这些 linter 的计划。可以逐步启用:
- 先启用
errcheck和misspell(相对简单,修复工作量较小) - 再启用
errname和staticcheck - 最后启用
gosec(可能需要更多安全相关修复)
这样可以逐步提高代码质量,同时避免一次性大规模重构。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with .golangci.yml and review the five commented linters: errcheck, errname, gosec, misspell, and staticcheck. Enable them incrementally, beginning with errcheck and misspell, then inspect and fix the reported existing issues. Done means the planned linters are enabled without unresolved findings, with the staged rollout documented if needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100