From 5f6939b590b820d1c4e488a2d000d41ac3ed3b34 Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Sun, 11 Oct 2026 10:16:58 +0800 Subject: [PATCH] =?UTF-8?q?revert(gateway):=20=E8=BF=98=E5=8E=9F=20discove?= =?UTF-8?q?r.go=20=E7=9A=84=E7=A9=BA=E7=99=BD=E9=87=8D=E6=8E=92=EF=BC=88?= =?UTF-8?q?=E9=9D=9E=E6=9C=AC=E6=AC=A1=E6=94=B9=E5=8A=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 我此前对 internal/gateway/ 跑了整目录 gofmt -w,它把 discover.go 里 注释对齐重排了(upstreamModel 的 struct tag 列、copyFields 的行内注释)。 那不是本次任务的改动,且会破坏变异测试 harness 的文本锚点 —— discover_mutate_test.go 按精确文本做变异注入,锚点对不上就直接判定 "这个变异会是 no-op" 并中止整套 harness。 教训:整目录 gofmt 会在你没打算改的文件上产生 diff。先还原。 --- internal/gateway/discover.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/gateway/discover.go b/internal/gateway/discover.go index 7a5efa4..3c5db64 100644 --- a/internal/gateway/discover.go +++ b/internal/gateway/discover.go @@ -535,11 +535,11 @@ type modelCaps struct { } type upstreamModel struct { - ID string `json:"id"` - Object string `json:"object"` - Kind string `json:"kind"` - Type string `json:"type"` - Modality string `json:"modality"` + ID string `json:"id"` + Object string `json:"object"` + Kind string `json:"kind"` + Type string `json:"type"` + Modality string `json:"modality"` Architecture struct { InputModalities []string `json:"input_modalities"` OutputModalities []string `json:"output_modalities"` @@ -699,8 +699,8 @@ func modelMeta(m upstreamModel) map[string]interface{} { } } - copyFields(m.Metadata) // nested first - copyFields(mustJSON(m)) // top level wins + copyFields(m.Metadata) // nested first + copyFields(mustJSON(m)) // top level wins if len(meta) == 0 { return nil }