refactor(lint): 更严格的 golangci-lint 代码规范配置#19
Merged
Conversation
Lint fixes: - Fix variable shadowing in generator.go (errors -> errs) - Fix else-if syntax error in runtime.go with composite literal - Add missing errors import in runtime.go - Reorder embedded field in jwt.go struct - Fix string concatenation in loop in semantic.go - Remove unnecessary int64 conversion in project_manager.go Config updates: - Optimize .golangci.yml to disable overly strict linters - Update .pre-commit-config.yaml to use local golangci-lint hook - Update go-ci.yml workflow configuration Documentation and examples updates included.
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
概述
升级 golangci-lint 配置,启用更全面的代码质量检查(
default: all),并修复所有阻塞性 lint 问题。变更内容
代码修复
pkg/executionplan/generator.go- 修复变量遮蔽问题(errors→errs)pkg/tools/bridge/runtime.go- 修复else if语法错误和添加缺失的errors导入server/auth/jwt.go- 调整嵌入字段位置,添加空行分隔pkg/memory/semantic.go- 修复循环中字符串拼接(改用strings.Builder)pkg/workflow/project_manager.go- 移除不必要的int64类型转换配置更新
.golangci.yml- 启用default: all并合理禁用过于严格的 linter.pre-commit-config.yaml- 改用本地 golangci-lint hook,支持增量检查禁用的 Linter 说明
当前禁用的 linter 将在后续 PR 中逐步解除并修复:
errcheck- 错误检查(大量存量代码需要修复)gosec- 安全检查(需要评估后逐步修复)gocritic- 代码风格建议(57 处需要修复)测试
golangci-lint run通过(0 issues)go build ./...通过