chore: stabilize lint and verify builds

This commit is contained in:
2026-02-06 11:51:32 +08:00
parent edede17880
commit 1782f64417
114 changed files with 3032 additions and 1345 deletions

View File

@@ -25,17 +25,19 @@ type ordersSnapshotWire struct {
Data json.RawMessage `json:"data"`
}
func (s *OrdersSnapshot) UnmarshalJSON(b []byte) error {
var w ordersSnapshotWire
if err := json.Unmarshal(b, &w); err == nil && (w.Kind != "" || w.Data != nil) {
s.Kind = w.Kind
s.Data = w.Data
func (snapshot *OrdersSnapshot) UnmarshalJSON(raw []byte) error {
var wire ordersSnapshotWire
if err := json.Unmarshal(raw, &wire); err == nil && (wire.Kind != "" || wire.Data != nil) {
snapshot.Kind = wire.Kind
snapshot.Data = wire.Data
return nil
}
// 兼容旧结构:旧 snapshot 通常是一个扁平对象(没有 kind/data
s.Kind = "legacy"
s.Data = append(s.Data[:0], b...)
snapshot.Kind = "legacy"
snapshot.Data = append(snapshot.Data[:0], raw...)
return nil
}