From c378dbfae1dd8eb07ad17495dbc1a53be7df0b86 Mon Sep 17 00:00:00 2001 From: xiongyuanwen-byted Date: Fri, 3 Jul 2026 11:14:30 +0800 Subject: [PATCH] fix(sheets): replace undefined common.FlagErrorf with sheetsValidationForFlag changesetRevisions called common.FlagErrorf, which does not exist, breaking the build. Use sheetsValidationForFlag so the errors carry the offending flag param like the rest of the sheets validation paths. Also reword two doc comments in lark_sheet_history_revert.go that used '' for an empty shell string: gofmt (Go 1.19+) rewrites '' in doc comments to a curly quote, leaving the file permanently unformatted. --- shortcuts/sheets/lark_sheet_changeset.go | 6 +++--- shortcuts/sheets/lark_sheet_history_revert.go | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/shortcuts/sheets/lark_sheet_changeset.go b/shortcuts/sheets/lark_sheet_changeset.go index 455e2fb8..27553309 100644 --- a/shortcuts/sheets/lark_sheet_changeset.go +++ b/shortcuts/sheets/lark_sheet_changeset.go @@ -75,14 +75,14 @@ func changesetRevisions(runtime flagView) (start int, end int, err error) { start = runtime.Int("start-revision") end = runtime.Int("end-revision") if start < 1 { - return 0, 0, common.FlagErrorf("--start-revision must be >= 1") + return 0, 0, sheetsValidationForFlag("start-revision", "--start-revision must be >= 1") } if end > 0 { if end < start { - return 0, 0, common.FlagErrorf("--end-revision (%d) must be >= --start-revision (%d)", end, start) + return 0, 0, sheetsValidationForFlag("end-revision", "--end-revision (%d) must be >= --start-revision (%d)", end, start) } if end-start+1 > changesetMaxRevGap { - return 0, 0, common.FlagErrorf("version gap exceeds limit %d (start=%d, end=%d)", changesetMaxRevGap, start, end) + return 0, 0, sheetsValidationForFlag("end-revision", "version gap exceeds limit %d (start=%d, end=%d)", changesetMaxRevGap, start, end) } } return start, end, nil diff --git a/shortcuts/sheets/lark_sheet_history_revert.go b/shortcuts/sheets/lark_sheet_history_revert.go index 249b3e8c..3ece1162 100644 --- a/shortcuts/sheets/lark_sheet_history_revert.go +++ b/shortcuts/sheets/lark_sheet_history_revert.go @@ -73,7 +73,8 @@ func historyRevertInput(token, versionID string) map[string]interface{} { // history version id — the facade-agg status tool keys on transaction_id). // Required at the cli surface (cobra MarkFlagRequired) — same gating model as // historyVersionIDFlag. Validate still trims + rejects empty/control-char -// values to catch the "--transaction-id ''" cobra-accepts-but-empty case. +// values to catch the case where cobra accepts --transaction-id with an +// empty-string value. func transactionIDFlag() common.Flag { return common.Flag{ Name: "transaction-id", @@ -110,7 +111,7 @@ func historyRevertStatusInput(token, transactionID string) map[string]interface{ // Validate runs with cobra's standard "required flag(s)" error (which the // dispatcher classifies as a typed *errs.ValidationError, exit 2). We still // trim + reject empty / control-char values in Validate to catch the -// "--history-version-id ''" cobra-accepts-but-empty case. +// case where cobra accepts --history-version-id with an empty-string value. var HistoryRevert = common.Shortcut{ Service: "sheets", Command: "+history-revert",