Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 0927446

Browse files
andreyneringkujtimiihoxha
authored andcommitted
chore: run gofumpt
1 parent f6386bd commit 0927446

17 files changed

Lines changed: 117 additions & 121 deletions

File tree

internal/app/lsp.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (app *App) initLSPClients(ctx context.Context) {
2525
func (app *App) createAndStartLSPClient(ctx context.Context, name string, command string, args ...string) {
2626
// Create a specific context for initialization with a timeout
2727
logging.Info("Creating LSP client", "name", name, "command", command, "args", args)
28-
28+
2929
// Create the LSP client
3030
lspClient, err := lsp.NewClient(ctx, command, args...)
3131
if err != nil {
@@ -36,7 +36,7 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman
3636
// Create a longer timeout for initialization (some servers take time to start)
3737
initCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
3838
defer cancel()
39-
39+
4040
// Initialize with the initialization context
4141
_, err = lspClient.InitializeLSPClient(initCtx, config.WorkingDirectory())
4242
if err != nil {
@@ -57,13 +57,13 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman
5757
}
5858

5959
logging.Info("LSP client initialized", "name", name)
60-
60+
6161
// Create a child context that can be canceled when the app is shutting down
6262
watchCtx, cancelFunc := context.WithCancel(ctx)
63-
63+
6464
// Create a context with the server name for better identification
6565
watchCtx = context.WithValue(watchCtx, "serverName", name)
66-
66+
6767
// Create the workspace watcher
6868
workspaceWatcher := watcher.NewWorkspaceWatcher(lspClient)
6969

internal/config/init.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,3 @@ func MarkProjectInitialized() error {
5858

5959
return nil
6060
}
61-

internal/llm/prompt/prompt_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ func createTestFiles(t *testing.T, tmpDir string, testFiles []string) {
4444
for _, path := range testFiles {
4545
fullPath := filepath.Join(tmpDir, path)
4646
if path[len(path)-1] == '/' {
47-
err := os.MkdirAll(fullPath, 0755)
47+
err := os.MkdirAll(fullPath, 0o755)
4848
require.NoError(t, err)
4949
} else {
5050
dir := filepath.Dir(fullPath)
51-
err := os.MkdirAll(dir, 0755)
51+
err := os.MkdirAll(dir, 0o755)
5252
require.NoError(t, err)
53-
err = os.WriteFile(fullPath, []byte(path+": test content"), 0644)
53+
err = os.WriteFile(fullPath, []byte(path+": test content"), 0o644)
5454
require.NoError(t, err)
5555
}
5656
}

internal/llm/provider/azure.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type azureClient struct {
1616
type AzureClient ProviderClient
1717

1818
func newAzureClient(opts providerClientOptions) AzureClient {
19-
2019
endpoint := os.Getenv("AZURE_OPENAI_ENDPOINT") // ex: https://foo.openai.azure.com
2120
apiVersion := os.Getenv("AZURE_OPENAI_API_VERSION") // ex: 2025-04-01-preview
2221

internal/llm/provider/bedrock.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,3 @@ func (b *bedrockClient) stream(ctx context.Context, messages []message.Message,
9898

9999
return b.childProvider.stream(ctx, messages, tools)
100100
}
101-

internal/llm/tools/ls_test.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ func TestLsTool_Run(t *testing.T) {
5656
// Create directories
5757
for _, dir := range testDirs {
5858
dirPath := filepath.Join(tempDir, dir)
59-
err := os.MkdirAll(dirPath, 0755)
59+
err := os.MkdirAll(dirPath, 0o755)
6060
require.NoError(t, err)
6161
}
6262

6363
// Create files
6464
for _, file := range testFiles {
6565
filePath := filepath.Join(tempDir, file)
66-
err := os.WriteFile(filePath, []byte("test content"), 0644)
66+
err := os.WriteFile(filePath, []byte("test content"), 0o644)
6767
require.NoError(t, err)
6868
}
6969

@@ -83,19 +83,19 @@ func TestLsTool_Run(t *testing.T) {
8383

8484
response, err := tool.Run(context.Background(), call)
8585
require.NoError(t, err)
86-
86+
8787
// Check that visible directories and files are included
8888
assert.Contains(t, response.Content, "dir1")
8989
assert.Contains(t, response.Content, "dir2")
9090
assert.Contains(t, response.Content, "dir3")
9191
assert.Contains(t, response.Content, "file1.txt")
9292
assert.Contains(t, response.Content, "file2.txt")
93-
93+
9494
// Check that hidden files and directories are not included
9595
assert.NotContains(t, response.Content, ".hidden_dir")
9696
assert.NotContains(t, response.Content, ".hidden_file.txt")
9797
assert.NotContains(t, response.Content, ".hidden_root_file.txt")
98-
98+
9999
// Check that __pycache__ is not included
100100
assert.NotContains(t, response.Content, "__pycache__")
101101
})
@@ -122,7 +122,7 @@ func TestLsTool_Run(t *testing.T) {
122122
t.Run("handles empty path parameter", func(t *testing.T) {
123123
// For this test, we need to mock the config.WorkingDirectory function
124124
// Since we can't easily do that, we'll just check that the response doesn't contain an error message
125-
125+
126126
tool := NewLsTool()
127127
params := LSParams{
128128
Path: "",
@@ -138,7 +138,7 @@ func TestLsTool_Run(t *testing.T) {
138138

139139
response, err := tool.Run(context.Background(), call)
140140
require.NoError(t, err)
141-
141+
142142
// The response should either contain a valid directory listing or an error
143143
// We'll just check that it's not empty
144144
assert.NotEmpty(t, response.Content)
@@ -173,11 +173,11 @@ func TestLsTool_Run(t *testing.T) {
173173

174174
response, err := tool.Run(context.Background(), call)
175175
require.NoError(t, err)
176-
176+
177177
// The output format is a tree, so we need to check for specific patterns
178178
// Check that file1.txt is not directly mentioned
179179
assert.NotContains(t, response.Content, "- file1.txt")
180-
180+
181181
// Check that dir1/ is not directly mentioned
182182
assert.NotContains(t, response.Content, "- dir1/")
183183
})
@@ -189,12 +189,12 @@ func TestLsTool_Run(t *testing.T) {
189189
defer func() {
190190
os.Chdir(origWd)
191191
}()
192-
192+
193193
// Change to a directory above the temp directory
194194
parentDir := filepath.Dir(tempDir)
195195
err = os.Chdir(parentDir)
196196
require.NoError(t, err)
197-
197+
198198
tool := NewLsTool()
199199
params := LSParams{
200200
Path: filepath.Base(tempDir),
@@ -210,7 +210,7 @@ func TestLsTool_Run(t *testing.T) {
210210

211211
response, err := tool.Run(context.Background(), call)
212212
require.NoError(t, err)
213-
213+
214214
// Should list the temp directory contents
215215
assert.Contains(t, response.Content, "dir1")
216216
assert.Contains(t, response.Content, "file1.txt")
@@ -291,22 +291,22 @@ func TestCreateFileTree(t *testing.T) {
291291
}
292292

293293
tree := createFileTree(paths)
294-
294+
295295
// Check the structure of the tree
296296
assert.Len(t, tree, 1) // Should have one root node
297-
297+
298298
// Check the root node
299299
rootNode := tree[0]
300300
assert.Equal(t, "path", rootNode.Name)
301301
assert.Equal(t, "directory", rootNode.Type)
302302
assert.Len(t, rootNode.Children, 1)
303-
303+
304304
// Check the "to" node
305305
toNode := rootNode.Children[0]
306306
assert.Equal(t, "to", toNode.Name)
307307
assert.Equal(t, "directory", toNode.Type)
308308
assert.Len(t, toNode.Children, 3) // file1.txt, dir1, dir2
309-
309+
310310
// Find the dir1 node
311311
var dir1Node *TreeNode
312312
for _, child := range toNode.Children {
@@ -315,7 +315,7 @@ func TestCreateFileTree(t *testing.T) {
315315
break
316316
}
317317
}
318-
318+
319319
require.NotNil(t, dir1Node)
320320
assert.Equal(t, "directory", dir1Node.Type)
321321
assert.Len(t, dir1Node.Children, 2) // file2.txt and subdir
@@ -354,9 +354,9 @@ func TestPrintTree(t *testing.T) {
354354
Type: "file",
355355
},
356356
}
357-
357+
358358
result := printTree(tree, "/root")
359-
359+
360360
// Check the output format
361361
assert.Contains(t, result, "- /root/")
362362
assert.Contains(t, result, " - dir1/")
@@ -390,22 +390,22 @@ func TestListDirectory(t *testing.T) {
390390
// Create directories
391391
for _, dir := range testDirs {
392392
dirPath := filepath.Join(tempDir, dir)
393-
err := os.MkdirAll(dirPath, 0755)
393+
err := os.MkdirAll(dirPath, 0o755)
394394
require.NoError(t, err)
395395
}
396396

397397
// Create files
398398
for _, file := range testFiles {
399399
filePath := filepath.Join(tempDir, file)
400-
err := os.WriteFile(filePath, []byte("test content"), 0644)
400+
err := os.WriteFile(filePath, []byte("test content"), 0o644)
401401
require.NoError(t, err)
402402
}
403403

404404
t.Run("lists files with no limit", func(t *testing.T) {
405405
files, truncated, err := listDirectory(tempDir, []string{}, 1000)
406406
require.NoError(t, err)
407407
assert.False(t, truncated)
408-
408+
409409
// Check that visible files and directories are included
410410
containsPath := func(paths []string, target string) bool {
411411
targetPath := filepath.Join(tempDir, target)
@@ -416,12 +416,12 @@ func TestListDirectory(t *testing.T) {
416416
}
417417
return false
418418
}
419-
419+
420420
assert.True(t, containsPath(files, "dir1"))
421421
assert.True(t, containsPath(files, "file1.txt"))
422422
assert.True(t, containsPath(files, "file2.txt"))
423423
assert.True(t, containsPath(files, "dir1/file3.txt"))
424-
424+
425425
// Check that hidden files and directories are not included
426426
assert.False(t, containsPath(files, ".hidden_dir"))
427427
assert.False(t, containsPath(files, ".hidden_file.txt"))
@@ -438,12 +438,12 @@ func TestListDirectory(t *testing.T) {
438438
files, truncated, err := listDirectory(tempDir, []string{"*.txt"}, 1000)
439439
require.NoError(t, err)
440440
assert.False(t, truncated)
441-
441+
442442
// Check that no .txt files are included
443443
for _, file := range files {
444444
assert.False(t, strings.HasSuffix(file, ".txt"), "Found .txt file: %s", file)
445445
}
446-
446+
447447
// But directories should still be included
448448
containsDir := false
449449
for _, file := range files {
@@ -454,4 +454,4 @@ func TestListDirectory(t *testing.T) {
454454
}
455455
assert.True(t, containsDir)
456456
})
457-
}
457+
}

internal/llm/tools/shell/shell.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ func GetPersistentShell(workingDir string) *PersistentShell {
6161
func newPersistentShell(cwd string) *PersistentShell {
6262
// Get shell configuration from config
6363
cfg := config.Get()
64-
64+
6565
// Default to environment variable if config is not set or nil
6666
var shellPath string
6767
var shellArgs []string
68-
68+
6969
if cfg != nil {
7070
shellPath = cfg.Shell.Path
7171
shellArgs = cfg.Shell.Args
7272
}
73-
73+
7474
if shellPath == "" {
7575
shellPath = os.Getenv("SHELL")
7676
if shellPath == "" {
7777
shellPath = "/bin/bash"
7878
}
7979
}
80-
80+
8181
// Default shell args
8282
if len(shellArgs) == 0 {
8383
shellArgs = []string{"-l"}

internal/tui/components/dialog/custom_commands.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func loadCommandsFromDir(commandsDir string, prefix string) ([]Command, error) {
8282
// Check if the commands directory exists
8383
if _, err := os.Stat(commandsDir); os.IsNotExist(err) {
8484
// Create the commands directory if it doesn't exist
85-
if err := os.MkdirAll(commandsDir, 0755); err != nil {
85+
if err := os.MkdirAll(commandsDir, 0o755); err != nil {
8686
return nil, fmt.Errorf("failed to create commands directory %s: %w", commandsDir, err)
8787
}
8888
// Return empty list since we just created the directory
@@ -171,7 +171,6 @@ func loadCommandsFromDir(commandsDir string, prefix string) ([]Command, error) {
171171
commands = append(commands, command)
172172
return nil
173173
})
174-
175174
if err != nil {
176175
return nil, fmt.Errorf("failed to load custom commands from %s: %w", commandsDir, err)
177176
}

0 commit comments

Comments
 (0)