unparam 死代码清理 12→2(保留 2 处 objectstore 构造函数统一签名):移除 10 处恒 nil error / 从未使用的结果(getPoWConfigForRoute 的恒 nil *PoWConfig、getSQLiteOverview/getPostgresOverview/getStatus/loadKumaConfig/filterExpectedRoutes 的恒 nil error、rawJSONString/parsePositiveInt 的弃用 bool、buildProxyRoute 的弃用 []ZoneDomain、getLocked 的恒 nil error),同步简化 12+ 处调用方与死错误检查。9 个受影响包测试通过。metric 持平 8(改进在基准之外)。

Result: {"status":"keep","total_issues":8,"golint_canonicalheader":0,"golint_errname":0,"golint_errorlint":1,"golint_exhaustive":0,"golint_forcetypeassert":0,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":0,"golint_recvcheck":1,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":8,"golint_test_testifylint":0,"golint_test_thelper":0,"golint_test_usetesting":0,"golint_test_total":0,"golint_vetx_total":0,"eslint_problems":0,"eslint_errors":0,"eslint_warnings":0,"tsc_errors":0,"measure_s":43}
This commit is contained in:
ryan
2026-08-16 18:29:51 +08:00
parent d7b8f44f90
commit c85373ff47
12 changed files with 64 additions and 80 deletions
+6 -6
View File
@@ -90,11 +90,11 @@ func rebindPagesRouteMaps(ctx context.Context, routes []map[string]json.RawMessa
if route == nil {
continue
}
upstreamType, _ := rawJSONString(route["upstream_type"])
upstreamType := rawJSONString(route["upstream_type"])
if !strings.EqualFold(strings.TrimSpace(upstreamType), "pages") {
continue
}
siteName, _ := rawJSONString(route["site_name"])
siteName := rawJSONString(route["site_name"])
projectID, err := resolveProjectIDFromRouteMap(route)
if err != nil {
if siteName == "" {
@@ -225,15 +225,15 @@ func buildLivePagesDeployment(
}, nil
}
func rawJSONString(raw json.RawMessage) (string, bool) {
func rawJSONString(raw json.RawMessage) string {
if !isPresentJSON(raw) {
return "", false
return ""
}
var value string
if err := json.Unmarshal(raw, &value); err != nil {
return "", false
return ""
}
return value, true
return value
}
func putJSON(route map[string]json.RawMessage, key string, value any) error {