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
This commit is contained in:
Claude committed 2026-04-15 20:49:13 +08:00
1 parent 0d92d808a3
commit 7980a70a30
5 files changed
+2 -16

No files matched your search

-7
View File
@@ -399,13 +399,6 @@ func (a *Agent) storePersistentModelCache(snapshot opencodeModelDiscoverySnapsho
return nil
}
// discoverModels runs `<cmd> 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
+1 -1
View File
@@ -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) {
-2
View File
@@ -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()
+1 -1
View File
@@ -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)
})
}
-5
View File
@@ -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)