"backend/cmd/vscode:/vscode.git/clone" did not exist on "3fcb0cc37c48a8e06022a60ea221a589a85ee4c7"
Commit 841d7ef2 authored by IanShaw027's avatar IanShaw027
Browse files

fix(lint): 修复 golangci-lint 检查问题

- 格式化代码(gofmt)
- 修复空指针检查(staticcheck)
- 删除未使用的函数(unused)
parent a7a49be8
...@@ -1013,4 +1013,3 @@ func shouldSkipOpsErrorLog(ctx context.Context, ops *service.OpsService, message ...@@ -1013,4 +1013,3 @@ func shouldSkipOpsErrorLog(ctx context.Context, ops *service.OpsService, message
return false return false
} }
...@@ -967,6 +967,7 @@ func buildOpsErrorLogsWhere(filter *service.OpsErrorLogFilter) (string, []any) { ...@@ -967,6 +967,7 @@ func buildOpsErrorLogsWhere(filter *service.OpsErrorLogFilter) (string, []any) {
args = append(args, phase) args = append(args, phase)
clauses = append(clauses, "error_phase = $"+itoa(len(args))) clauses = append(clauses, "error_phase = $"+itoa(len(args)))
} }
if filter != nil {
if owner := strings.TrimSpace(strings.ToLower(filter.Owner)); owner != "" { if owner := strings.TrimSpace(strings.ToLower(filter.Owner)); owner != "" {
args = append(args, owner) args = append(args, owner)
clauses = append(clauses, "LOWER(COALESCE(error_owner,'')) = $"+itoa(len(args))) clauses = append(clauses, "LOWER(COALESCE(error_owner,'')) = $"+itoa(len(args)))
...@@ -975,6 +976,7 @@ func buildOpsErrorLogsWhere(filter *service.OpsErrorLogFilter) (string, []any) { ...@@ -975,6 +976,7 @@ func buildOpsErrorLogsWhere(filter *service.OpsErrorLogFilter) (string, []any) {
args = append(args, source) args = append(args, source)
clauses = append(clauses, "LOWER(COALESCE(error_source,'')) = $"+itoa(len(args))) clauses = append(clauses, "LOWER(COALESCE(error_source,'')) = $"+itoa(len(args)))
} }
}
if resolvedFilter != nil { if resolvedFilter != nil {
args = append(args, *resolvedFilter) args = append(args, *resolvedFilter)
clauses = append(clauses, "COALESCE(resolved,false) = $"+itoa(len(args))) clauses = append(clauses, "COALESCE(resolved,false) = $"+itoa(len(args)))
......
...@@ -612,11 +612,3 @@ func sanitizeErrorBodyForStorage(raw string, maxBytes int) (sanitized string, tr ...@@ -612,11 +612,3 @@ func sanitizeErrorBodyForStorage(raw string, maxBytes int) (sanitized string, tr
return raw, false return raw, false
} }
func extractString(v any, key string) string {
root, ok := v.(map[string]any)
if !ok {
return ""
}
s, _ := root[key].(string)
return strings.TrimSpace(s)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment