From 86fad02c41803d5abcd1523a559b0408a83fb576 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 16 Aug 2026 17:52:03 +0800 Subject: [PATCH] =?UTF-8?q?errorlint=2012=E2=86=921=EF=BC=9A3=20=E5=A4=84?= =?UTF-8?q?=20cmd=20=E5=85=A5=E5=8F=A3=20err!=3Dcontext.Canceled=E2=86=92e?= =?UTF-8?q?rrors.Is=EF=BC=88=E9=98=B2=E5=BE=A1=E6=80=A7=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E5=89=8D=20runner=20=E4=B8=8D=20wrap=20=E8=AF=AD=E4=B9=89?= =?UTF-8?q?=E4=B8=8D=E5=8F=98=EF=BC=89=EF=BC=9B2=20=E5=A4=84=20strconv.Num?= =?UTF-8?q?Error=20=E6=96=AD=E8=A8=80=E3=80=811=20=E5=A4=84=20viper=20?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E3=80=812=20=E5=A4=84=20=3D=3Dio.EOF?= =?UTF-8?q?=E3=80=812=20=E5=A4=84=20=3D=3Dredis.Nil=E3=80=811=20=E5=A4=84?= =?UTF-8?q?=20=3D=3Dgorm.ErrRecordNotFound=E2=86=92errors.As/Is=EF=BC=9B8?= =?UTF-8?q?=20=E5=A4=84=20%v=E2=86=92%w=20=E4=BF=9D=E7=95=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=93=BE=E3=80=82=E5=88=BB=E6=84=8F=E4=BF=9D=E7=95=99?= =?UTF-8?q?=20telegram.go=20=E5=8D=95=E5=A4=84=20%v=EF=BC=88=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E9=94=99=E8=AF=AF=E4=BB=85=E4=BD=9C=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=96=87=E6=96=87=E6=9C=AC=EF=BC=8Cwrap=20=E4=BC=9A=E6=94=B9?= =?UTF-8?q?=E5=8F=98=20errors.Is=20=E5=8C=B9=E9=85=8D=E8=AF=AD=E4=B9=89?= =?UTF-8?q?=EF=BC=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Result: {"status":"keep","total_issues":22,"golint_canonicalheader":0,"golint_errname":1,"golint_errorlint":1,"golint_forcetypeassert":3,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":3,"golint_recvcheck":7,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":21,"eslint_problems":1,"eslint_errors":0,"eslint_warnings":1,"tsc_errors":0,"measure_s":46} --- .auto/log.jsonl | 1 + cmd/agent/main.go | 3 ++- cmd/flared/main.go | 3 ++- cmd/relay/main.go | 3 ++- internal/apps/agent/nginx/manager.go | 8 ++++---- internal/apps/agent/sync/service.go | 2 +- internal/apps/edge/updater/restart_unix.go | 4 ++-- internal/apps/openflare/node/helpers.go | 6 +++--- internal/apps/openflare/node/logics.go | 2 +- internal/apps/openflare/option/openresty_validators.go | 2 +- internal/apps/openflare/pages/rebind.go | 2 +- internal/apps/openflare/tls/acme/client.go | 2 +- internal/apps/upload/filesrv/file_server.go | 3 ++- internal/apps/upload/handler/file_management.go | 2 +- internal/apps/upload/handler/routers.go | 3 ++- internal/infra/config/config.go | 4 +++- pkg/cap/store.go | 5 +++-- pkg/pagesarchive/extract.go | 2 +- pkg/pagesarchive/inspect.go | 2 +- 19 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.auto/log.jsonl b/.auto/log.jsonl index 74e2d47c..b1df4fd6 100644 --- a/.auto/log.jsonl +++ b/.auto/log.jsonl @@ -5,3 +5,4 @@ {"run":4,"commit":"699e95f","metric":56,"metrics":{"golint_canonicalheader":8,"golint_errname":1,"golint_errorlint":12,"golint_forcetypeassert":3,"golint_gosec":0,"golint_intrange":3,"golint_modernize":5,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":3,"golint_recvcheck":7,"golint_usestdlibvars":3,"golint_wastedassign":7,"golint_total":55,"eslint_problems":1,"eslint_errors":0,"eslint_warnings":1,"tsc_errors":0,"measure_s":47},"status":"keep","description":"perfsprint 18→0:strconv.Itoa/FormatInt/FormatUint/FormatBool 替代 fmt.Sprintf、无动词 fmt.Errorf→errors.New、纯字符串拼接。全部语义等价(已核对 diff)。修正 fixer 遗留的 import 问题(引入 goimports 统一整理)。","timestamp":1786872884713,"segment":0,"confidence":3.0588235294117645,"asi":{"hypothesis":"perfsprint --fix:%d→strconv.Itoa/FormatInt、%t→FormatBool、%s+const→拼接、无动词 Errorf→errors.New","insight":"重要:golangci-lint v2 fixer 的 import 管理不可靠(删除/添加 import 会出错,53 个文件中 5 处报 undefined)+ 遗留未用 import。已安装 goimports(repo make format 本来就需要它),对改动文件统一 goimports -w 修复。后续只要用 --fix 就要记得跑 goimports -w","next_action_hint":"剩余大头:errorlint(12)、canonicalheader(8)(usestdlibvars 同类)、recvcheck(7)、wastedassign(7)。errorlint 需手工逐处判断;先做 canonicalheader+usestdlibvars(自动可修复但要核对)"}} {"run":5,"commit":"d0414b4","metric":45,"metrics":{"golint_canonicalheader":0,"golint_errname":1,"golint_errorlint":12,"golint_forcetypeassert":3,"golint_gosec":0,"golint_intrange":3,"golint_modernize":5,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":3,"golint_recvcheck":7,"golint_usestdlibvars":0,"golint_wastedassign":7,"golint_total":44,"eslint_problems":1,"eslint_errors":0,"eslint_warnings":1,"tsc_errors":0,"measure_s":38},"status":"keep","description":"canonicalheader 8→0 + usestdlibvars 3→0:header key 改为 Go 规范大小写(wire 格式本就如此,纯代码修正)、HTTP 方法常量替代字符串字面量。","timestamp":1786873098921,"segment":0,"confidence":2.1724137931034484,"asi":{"hypothesis":"canonicalheader+usestdlibvars --fix:Header key 统一规范大小写、GET/OPTIONS 等方法常量","insight":"GitHub header 修正前后的 wire 格式完全一致(Go 在 Set 时本来就会规范化),纯代码层面修正,零行为风险;下次遇到同类 100% 安全","next_action_hint":"剩余:errorlint(12) 需逐处人工判断(其中 3 处 err != context.Canceled、2 处 %v wrap、若干 ==/类型断言);recvcheck(7) 是模型接收者一致性;wastedassign(7) 删 TODO 赋值;intrange(3)/modernize(5)/nilnil(3)/prealloc(3)/forcetypeassert(3)/errname(1)/eslint(1)"}} {"run":6,"commit":"ce28f63","metric":38,"metrics":{"golint_canonicalheader":0,"golint_errname":1,"golint_errorlint":12,"golint_forcetypeassert":3,"golint_gosec":0,"golint_intrange":3,"golint_modernize":5,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":3,"golint_recvcheck":7,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":37,"eslint_problems":1,"eslint_errors":0,"eslint_warnings":1,"tsc_errors":0,"measure_s":47},"status":"keep","description":"wastedassign 7→0:删除 7 处死初始化(snapshot.go 三连、push 三件套 content、format.go numStr),改 var 声明,零行为变化。","timestamp":1786873485497,"segment":0,"confidence":2.978723404255319,"asi":{"hypothesis":"wastedassign 7→0:删除 7 处死初始化(x := \"\" 后所有分支都赋值)改为 var 声明","insight":"replace 工具会归一化 replacement_text 的前导空白;对需要缩进的编辑直接用 sed/gofmt -w 处理更稳","next_action_hint":"剩余:errorlint(12)、recvcheck(7)、modernize(5)、intrange(3)、nilnil(3)、prealloc(3)、forcetypeassert(3)、errname(1)、eslint(1)"}} +{"run":7,"commit":"288b74d","metric":33,"metrics":{"golint_canonicalheader":0,"golint_errname":1,"golint_errorlint":12,"golint_forcetypeassert":3,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":3,"golint_recvcheck":7,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":32,"eslint_problems":1,"eslint_errors":0,"eslint_warnings":1,"tsc_errors":0,"measure_s":45},"status":"keep","description":"intrange 3→0 + modernize 5→3:for i:=0;i