on main help sign in
refactor: remove empty slice declarations (#2150)
commitf285804b6c5c45d0a37fad2e2edb0e56fe8aa034 authorAndrey Nering <andreynering@users.noreply.github.com> dateFri 6 Feb 2026, 16:31 (8 months ago) parent02f66a2
11 files changed+14−20
internal/agent/tools/diagnostics.go+3−3 internal/cmd/logs.go+2−2 internal/config/config.go+1−1 internal/config/load.go+1−7 internal/config/load_test.go+1−1 internal/ui/chat/agent.go+1−1 internal/ui/chat/lsp_restart.go+1−1 internal/ui/common/elements.go+1−1 internal/ui/dialog/arguments.go+1−1 internal/ui/model/lsp.go+1−1 internal/ui/model/mcp.go+1−1
internal/agent/tools/diagnostics.go+3−3
@@ -67,8 +67,8 @@ func getDiagnostics(filePath string, manager *lsp.Manager) string {
6767 return ""
6868 }
6969
70− fileDiagnostics := []string{}
71− projectDiagnostics := []string{}
70+ var fileDiagnostics []string
71+ var projectDiagnostics []string
7272
7373 for lspName, client := range manager.Clients().Seq2() {
7474 for location, diags := range client.GetDiagnostics() {
@@ -163,7 +163,7 @@ func formatDiagnostic(pth string, diagnostic protocol.Diagnostic, source string)
163163
164164 tagsInfo := ""
165165 if len(diagnostic.Tags) > 0 {
166− tags := []string{}
166+ var tags []string
167167 for _, tag := range diagnostic.Tags {
168168 switch tag {
169169 case protocol.Unnecessary:
internal/cmd/logs.go+2−2
@@ -171,8 +171,8 @@ func printLogLine(lineText string) {
171171 }
172172 msg := data["msg"]
173173 level := data["level"]
174− otherData := []any{}
175− keys := []string{}
174+ var otherData []any
175+ var keys []string
176176 for k := range data {
177177 keys = append(keys, k)
178178 }
internal/config/config.go+1−1
@@ -730,7 +730,7 @@ func resolveReadOnlyTools(tools []string) []string {
730730}
731731
732732func filterSlice(data []string, mask []string, include bool) []string {
733− filtered := []string{}
733+ var filtered []string
734734 for _, s := range data {
735735 // if include is true, we include items that ARE in the mask
736736 // if include is false, we include items that are NOT in the mask
internal/config/load.go+1−7
@@ -95,7 +95,7 @@ func Load(workingDir, dataDir string, debug bool) (*Config, error) {
9595}
9696
9797func PushPopCrushEnv() func() {
98− found := []string{}
98+ var found []string
9999 for _, ev := range os.Environ() {
100100 if strings.HasPrefix(ev, "CRUSH_") {
101101 pair := strings.SplitN(ev, "=", 2)
@@ -342,12 +342,6 @@ func (c *Config) setDefaults(workingDir, dataDir string) {
342342 if c.Options.TUI == nil {
343343 c.Options.TUI = &TUIOptions{}
344344 }
345− if c.Options.ContextPaths == nil {
346− c.Options.ContextPaths = []string{}
347− }
348− if c.Options.SkillsPaths == nil {
349− c.Options.SkillsPaths = []string{}
350− }
351345 if dataDir != "" {
352346 c.Options.DataDirectory = dataDir
353347 } else if c.Options.DataDirectory == "" {
internal/config/load_test.go+1−1
@@ -513,7 +513,7 @@ func TestConfig_setupAgentsWithEveryReadOnlyToolDisabled(t *testing.T) {
513513
514514 taskAgent, ok := cfg.Agents[AgentTask]
515515 require.True(t, ok)
516− assert.Equal(t, []string{}, taskAgent.AllowedTools)
516+ assert.Len(t, taskAgent.AllowedTools, 0)
517517}
518518
519519func TestConfig_configureProvidersWithDisabledProvider(t *testing.T) {
internal/ui/chat/agent.go+1−1
@@ -242,7 +242,7 @@ func (r *AgenticFetchToolRenderContext) RenderTool(sty *styles.Styles, width int
242242 prompt = strings.ReplaceAll(prompt, "\n", " ")
243243
244244 // Build header with optional URL param.
245− toolParams := []string{}
245+ var toolParams []string
246246 if params.URL != "" {
247247 toolParams = append(toolParams, params.URL)
248248 }
internal/ui/chat/lsp_restart.go+1−1
@@ -38,7 +38,7 @@ func (r *LSPRestartToolRenderContext) RenderTool(sty *styles.Styles, width int,
3838 var params tools.LSPRestartParams
3939 _ = json.Unmarshal([]byte(opts.ToolCall.Input), &params)
4040
41− toolParams := []string{}
41+ var toolParams []string
4242 if params.Name != "" {
4343 toolParams = append(toolParams, params.Name)
4444 }
internal/ui/common/elements.go+1−1
@@ -137,7 +137,7 @@ func Status(t *styles.Styles, opts StatusOpts, width int) string {
137137 description = t.Base.Foreground(descriptionColor).Render(description)
138138 }
139139
140− content := []string{}
140+ var content []string
141141 if icon != "" {
142142 content = append(content, icon)
143143 }
internal/ui/dialog/arguments.go+1−1
@@ -342,7 +342,7 @@ func (a *Arguments) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
342342 if scrollbar != "" {
343343 content = lipgloss.JoinHorizontal(lipgloss.Top, content, scrollbar)
344344 }
345− contentParts := []string{}
345+ var contentParts []string
346346 if description != "" {
347347 contentParts = append(contentParts, description)
348348 }
internal/ui/model/lsp.go+1−1
@@ -60,7 +60,7 @@ func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
6060
6161// lspDiagnostics formats diagnostic counts with appropriate icons and colors.
6262func lspDiagnostics(t *styles.Styles, diagnostics map[protocol.DiagnosticSeverity]int) string {
63− errs := []string{}
63+ var errs []string
6464 if diagnostics[protocol.SeverityError] > 0 {
6565 errs = append(errs, t.LSP.ErrorDiagnostic.Render(fmt.Sprintf("%s%d", styles.LSPErrorIcon, diagnostics[protocol.SeverityError])))
6666 }
internal/ui/model/mcp.go+1−1
@@ -36,7 +36,7 @@ func (m *UI) mcpInfo(width, maxItems int, isSection bool) string {
3636
3737// mcpCounts formats tool, prompt, and resource counts for display.
3838func mcpCounts(t *styles.Styles, counts mcp.Counts) string {
39− parts := []string{}
39+ var parts []string
4040 if counts.Tools > 0 {
4141 parts = append(parts, t.Subtle.Render(fmt.Sprintf("%d tools", counts.Tools)))
4242 }