ci(lint): golangci-lint v2 入门禁并归零
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s

- .golangci.yml:standard 集 - errcheck(存量 38 处裸忽略待专项),staticcheck 关纯风格/quickfix
- 清理 3 个无引用死函数;SanitizedJSON 不可达分支收敛为接口分支 + nil 指针防护(原死分支中的 nil 检查从未执行)
- CI backend job 增加 golangci-lint-action@v6
This commit is contained in:
opsx committed 2026-10-29 13:29:25 +08:00
1 parent a69142fbfe
commit c33ea9d0a8
5 files changed
+20 -58

No files matched your search

+1 -28
View File
@@ -10,35 +10,8 @@ type Sanitizer interface {
// 使用接口替代类型断言,更优雅且可扩展。
func SanitizedJSON(v any) any {
switch val := v.(type) {
// Single objects: 尝试Sanitizer接口
// Single objects: 实现 Sanitizer 接口的类型统一走这里(nil 指针安全返回 nil)
case Sanitizer:
return val.Sanitized()
case *User:
if val == nil {
return nil
}
return val.Sanitized()
case *Cluster:
if val == nil {
return nil
}
return val.Sanitized()
case *Host:
if val == nil {
return nil
}
return val.Sanitized()
case *StorageConfig:
if val == nil {
return nil
}
return val.Sanitized()
case *Collector:
if val == nil {
return nil
}
return val.Sanitized()
case *LokiDeployment:
if val == nil {
return nil
}