From 7980a70a30a99b8056d50a3927548e9cd73041a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Apr 2026 20:48:41 +0800 Subject: [PATCH] chore: fix golangci-lint errors flagged by CI - management.go: check w.Write return value - config_cmd.go: check fs.Parse return value - web_manager.go: remove unused defaultMgmtPort/defaultBridgePort consts - opencode.go: remove unused discoverModels wrapper - engine.go: remove ineffectual resolvedWorkspace assignment Made-with: Cursor --- agent/opencode/opencode.go | 7 ------- cmd/cc-connect/config_cmd.go | 2 +- core/engine.go | 2 -- core/management.go | 2 +- core/web_manager.go | 5 ----- 5 files changed, 2 insertions(+), 16 deletions(-) diff --git a/agent/opencode/opencode.go b/agent/opencode/opencode.go index 20a4be3c4..c604ccf79 100644 --- a/agent/opencode/opencode.go +++ b/agent/opencode/opencode.go @@ -399,13 +399,6 @@ func (a *Agent) storePersistentModelCache(snapshot opencodeModelDiscoverySnapsho return nil } -// discoverModels runs ` models` and parses stdout line-by-line into a -// normalized slice of ModelOption. -// Returns nil if the command fails, times out, or produces no usable output. -func (a *Agent) discoverModels(ctx context.Context) []core.ModelOption { - return a.discoverModelsWithSnapshot(ctx, a.modelDiscoverySnapshot()) -} - func (a *Agent) discoverModelsWithSnapshot(ctx context.Context, snapshot opencodeModelDiscoverySnapshot) []core.ModelOption { c := exec.CommandContext(ctx, snapshot.cmd, "models") c.Dir = snapshot.workDir diff --git a/cmd/cc-connect/config_cmd.go b/cmd/cc-connect/config_cmd.go index 4e5bcf6b2..de1c905f3 100644 --- a/cmd/cc-connect/config_cmd.go +++ b/cmd/cc-connect/config_cmd.go @@ -31,7 +31,7 @@ func runConfig(args []string) { func runConfigFormat(args []string) { fs := flag.NewFlagSet("config format", flag.ExitOnError) configPath := fs.String("config", "", "path to config file (default: auto-detect)") - fs.Parse(args) + _ = fs.Parse(args) path := resolveConfigPath(*configPath) if _, err := os.Stat(path); os.IsNotExist(err) { diff --git a/core/engine.go b/core/engine.go index 5c8992793..03d9ac3da 100644 --- a/core/engine.go +++ b/core/engine.go @@ -1466,8 +1466,6 @@ func (e *Engine) handleMessage(p Platform, msg *Message) { return } } else { - resolvedWorkspace = workspace - // Touch for idle tracking if ws := e.workspacePool.Get(workspace); ws != nil { ws.Touch() diff --git a/core/management.go b/core/management.go index d61fe92a2..905d39ca8 100644 --- a/core/management.go +++ b/core/management.go @@ -204,7 +204,7 @@ func (m *ManagementServer) withStaticFallback(apiMux *http.ServeMux) http.Handle return } w.Header().Set("Content-Type", "text/html; charset=utf-8") - w.Write(indexData) + _, _ = w.Write(indexData) }) } diff --git a/core/web_manager.go b/core/web_manager.go index e8bd6caa6..3ba9ba833 100644 --- a/core/web_manager.go +++ b/core/web_manager.go @@ -7,11 +7,6 @@ import ( "time" ) -const ( - defaultMgmtPort = 9820 - defaultBridgePort = 9810 -) - // GenerateToken creates a random hex token. func GenerateToken(n int) string { b := make([]byte, n)