fix(lint): 修复所有golangci-lint错误

- 修复depguard错误:为ops service文件添加redis导入例外
- 修复errcheck错误:添加错误检查和类型断言检查
- 修复gofmt错误:格式化代码
- 修复ineffassign错误:移除无效的idx++赋值
- 修复staticcheck错误:合并条件赋值
- 修复unused错误:移除未使用的字段和函数
  - ops_cleanup_service.go: entryID字段
  - ops_retry.go: status字段
  - ops_upstream_context.go: getOpsUpstreamErrors函数
This commit is contained in:
IanShaw027
2026-01-11 23:26:29 +08:00
parent 4cb7b26f03
commit 54c5788b86
13 changed files with 15 additions and 32 deletions

View File

@@ -430,4 +430,3 @@ func (h *OpsHandler) ListAlertEvents(c *gin.Context) {
}
response.Success(c, events)
}

View File

@@ -146,4 +146,3 @@ func (h *OpsHandler) UpdateAdvancedSettings(c *gin.Context) {
}
response.Success(c, updated)
}

View File

@@ -391,7 +391,7 @@ func tryAcquireOpsWSIPSlot(clientIP string, limit int32) bool {
}
v, _ := wsConnCountByIP.LoadOrStore(clientIP, &atomic.Int32{})
counter := v.(*atomic.Int32)
counter, ok := v.(*atomic.Int32); if !ok { return }
for {
current := counter.Load()
@@ -413,7 +413,7 @@ func releaseOpsWSIPSlot(clientIP string) {
if !ok {
return
}
counter := v.(*atomic.Int32)
counter, ok := v.(*atomic.Int32); if !ok { return }
next := counter.Add(-1)
if next <= 0 {
// Best-effort cleanup; safe even if a new slot was acquired concurrently.