chore(cli): gofmt sweep

`gofmt -w cli/` — trailing newlines, minor whitespace alignment. Caught
during PR-readiness review (`gofmt -l .` had been non-clean since the
em-dash → ASCII bulk replace earlier in the v0.4 series).
This commit is contained in:
nullkey
2026-05-15 05:00:26 +08:00
committed by lyingbug
parent f2e8e3f56c
commit 69fbbfc252
30 changed files with 74 additions and 84 deletions
+2
View File
@@ -33,7 +33,9 @@ func TestMain(m *testing.M) {
} }
// update is the standard Go test golden-update flag. // update is the standard Go test golden-update flag.
//
// go test -update ./acceptance/contract/... // go test -update ./acceptance/contract/...
//
// Mirrors gh / kubectl / golang-migrate convention. // Mirrors gh / kubectl / golang-migrate convention.
var update = flag.Bool("update", false, "update golden files") var update = flag.Bool("update", false, "update golden files")
+1
View File
@@ -45,6 +45,7 @@ import (
) )
// wireCase declares one row in the contract matrix. Optional fields: // wireCase declares one row in the contract matrix. Optional fields:
//
// server - mock /api/v1/* endpoints; nil means no network. // server - mock /api/v1/* endpoints; nil means no network.
// preConfig - seed config.yaml under the per-test XDG_CONFIG_HOME // preConfig - seed config.yaml under the per-test XDG_CONFIG_HOME
// (set by newTestFactory); use for cases like // (set by newTestFactory); use for cases like
+1
View File
@@ -5,6 +5,7 @@
// reviewer immediately sees "this is the contract surface - change with care". // reviewer immediately sees "this is the contract surface - change with care".
// //
// Sub-packages: // Sub-packages:
//
// contract/ - envelope JSON shape golden + error.code registry consistency // contract/ - envelope JSON shape golden + error.code registry consistency
// e2e/ - real WeKnora server blackbox tests (testscript-style) // e2e/ - real WeKnora server blackbox tests (testscript-style)
package acceptance package acceptance
-1
View File
@@ -84,4 +84,3 @@ func runList(jopts *cmdutil.JSONOptions, f *cmdutil.Factory) error {
} }
return tw.Flush() return tw.Flush()
} }
-1
View File
@@ -145,4 +145,3 @@ func validateName(name string) error {
} }
return nil return nil
} }
-1
View File
@@ -140,4 +140,3 @@ func TestAdd_JSON(t *testing.T) {
t.Errorf("first added context must be current=true, got %v", got) t.Errorf("first added context must be current=true, got %v", got)
} }
} }
-1
View File
@@ -124,4 +124,3 @@ func clearContextSecrets(store secrets.Store, c config.Context, name string) {
_ = store.Delete(name, "api_key") _ = store.Delete(name, "api_key")
} }
} }
-1
View File
@@ -203,4 +203,3 @@ func TestRemove_Current_TTY_PromptNo(t *testing.T) {
t.Errorf("aborted remove must not mutate config") t.Errorf("aborted remove must not mutate config")
} }
} }
+3 -2
View File
@@ -128,7 +128,9 @@ func TestList_KBIDRequired(t *testing.T) {
} }
f := &cmdutil.Factory{ f := &cmdutil.Factory{
Config: func() (*config.Config, error) { return cfg, nil }, Config: func() (*config.Config, error) { return cfg, nil },
Client: func() (*sdk.Client, error) { return nil, errors.New("client should not be called when kb id is missing") }, Client: func() (*sdk.Client, error) {
return nil, errors.New("client should not be called when kb id is missing")
},
} }
cmd := NewCmdList(f) cmd := NewCmdList(f)
cmd.SetContext(context.Background()) cmd.SetContext(context.Background())
@@ -337,4 +339,3 @@ func TestList_AllPages_WithLimit_StopsAtLimit(t *testing.T) {
// Should have called pages 1..3 (60 items) then capped at 50. // Should have called pages 1..3 (60 items) then capped at 50.
assert.LessOrEqual(t, len(svc.calls), 3, "should not walk past the page that fills --limit") assert.LessOrEqual(t, len(svc.calls), 3, "should not walk past the page that fills --limit")
} }
-1
View File
@@ -163,4 +163,3 @@ func walkMatches(root, pattern string) ([]string, error) {
} }
return out, nil return out, nil
} }
-1
View File
@@ -191,4 +191,3 @@ func TestUploadRecursive_JSON_BareObject(t *testing.T) {
assert.True(t, typed.Silent, "JSON-path partial failure must be Silent") assert.True(t, typed.Silent, "JSON-path partial failure must be Silent")
assert.Equal(t, cmdutil.CodeServerError, typed.Code) assert.Equal(t, cmdutil.CodeServerError, typed.Code)
} }
-1
View File
@@ -450,4 +450,3 @@ func (s *realServices) GetSystemInfo(ctx context.Context) (*sdk.SystemInfo, erro
} }
return cli.GetSystemInfo(ctx) return cli.GetSystemInfo(ctx)
} }
-1
View File
@@ -79,4 +79,3 @@ func TestEmpty_NotFound(t *testing.T) {
require.ErrorAs(t, err, &typed) require.ErrorAs(t, err, &typed)
assert.Equal(t, cmdutil.CodeResourceNotFound, typed.Code) assert.Equal(t, cmdutil.CodeResourceNotFound, typed.Code)
} }
-1
View File
@@ -139,4 +139,3 @@ func TestRoot_ContextFlagPropagation(t *testing.T) {
}) })
} }
} }
-1
View File
@@ -116,4 +116,3 @@ func TestKBSearch_NetworkError(t *testing.T) {
require.ErrorAs(t, err, &typed) require.ErrorAs(t, err, &typed)
assert.Equal(t, cmdutil.CodeAuthUnauthenticated, typed.Code) assert.Equal(t, cmdutil.CodeAuthUnauthenticated, typed.Code)
} }
-1
View File
@@ -80,4 +80,3 @@ func TestDelete_TTY_ConfirmNo(t *testing.T) {
assert.False(t, svc.called) assert.False(t, svc.called)
assert.Contains(t, errBuf.String(), "Aborted") assert.Contains(t, errBuf.String(), "Aborted")
} }
-1
View File
@@ -261,4 +261,3 @@ func TestList_AllPages_WithLimit_StopsAtLimit(t *testing.T) {
assert.Equal(t, 50, got) assert.Equal(t, 50, got)
assert.LessOrEqual(t, len(svc.calls), 3, "must not fetch beyond what fills --limit") assert.LessOrEqual(t, len(svc.calls), 3, "must not fetch beyond what fills --limit")
} }
-1
View File
@@ -80,4 +80,3 @@ func applyBareFieldFilter(raw []byte, fields []string) ([]byte, error) {
return raw, nil return raw, nil
} }
} }
-1
View File
@@ -56,4 +56,3 @@ func TestWriteAtomicYAML_RoundTrip(t *testing.T) {
} }
} }
} }