Skip to content

Commit d764543

Browse files
committed
Revert nilerr linter: too many //nolint annotations
All 11 issues were intentional patterns, requiring 11 //nolint directives with no actual code improvement. Assisted-By: cagent
1 parent 3ca260c commit d764543

10 files changed

Lines changed: 11 additions & 12 deletions

File tree

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ linters:
3838
- misspell
3939
- mirror
4040
- nakedret
41-
- nilerr
4241
- nolintlint
4342
- nosprintfhostport
4443
- nilnesserr

pkg/acp/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.Promp
248248
// Run the agent and stream updates
249249
if err := a.runAgent(turnCtx, acpSess); err != nil {
250250
if turnCtx.Err() != nil {
251-
return acp.PromptResponse{StopReason: acp.StopReasonCancelled}, nil //nolint:nilerr // context cancellation is not an error, return cancelled status
251+
return acp.PromptResponse{StopReason: acp.StopReasonCancelled}, nil
252252
}
253253
return acp.PromptResponse{}, err
254254
}

pkg/app/export/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func ToFile(data SessionData, filename string) (string, error) {
155155

156156
absPath, err := filepath.Abs(filename)
157157
if err != nil {
158-
return filename, nil //nolint:nilerr // fall back to relative path if Abs fails
158+
return filename, nil
159159
}
160160
return absPath, nil
161161
}

pkg/fake/proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ func StreamCopy(c echo.Context, resp *http.Response) error {
430430
if result.err != nil {
431431
// io.EOF or context canceled means normal completion
432432
if errors.Is(result.err, io.EOF) || ctx.Err() != nil {
433-
return nil //nolint:nilerr // EOF and context cancellation are normal stream termination
433+
return nil
434434
}
435435
slog.ErrorContext(ctx, "stream read error", "error", result.err)
436436
return result.err

pkg/fsx/fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func directoryTree(path string, isPathAllowed func(string) error, shouldIgnore f
4343

4444
entries, err := os.ReadDir(path)
4545
if err != nil {
46-
return node, nil //nolint:nilerr // return partial tree on ReadDir failure
46+
return node, nil // Return partial result on error
4747
}
4848

4949
for _, entry := range entries {

pkg/skills/skills.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func loadSkillsRecursive(dir string) []Skill {
218218

219219
_ = filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
220220
if err != nil || d.IsDir() {
221-
return nil //nolint:nilerr // skip unreadable entries
221+
return nil
222222
}
223223
if isHiddenOrSymlink(d) || d.Name() != skillFile {
224224
return nil

pkg/teamloader/toon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (f *toonTools) Tools(ctx context.Context) ([]tools.Tool, error) {
3838
var o map[string]any
3939
err = json.Unmarshal([]byte(res.Output), &o)
4040
if err != nil {
41-
return res, nil //nolint:nilerr // output is not JSON, skip toon encoding
41+
return res, nil
4242
}
4343

4444
tooned, err := gotoon.Encode(o)

pkg/tools/builtin/filesystem.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ func (t *FilesystemTool) handleSearchFilesContent(_ context.Context, args Search
592592

593593
err := filepath.WalkDir(resolvedPath, func(path string, d fs.DirEntry, err error) error {
594594
if err != nil {
595-
return nil //nolint:nilerr // skip unreadable entries
595+
return nil
596596
}
597597

598598
// Check VCS ignore rules
@@ -606,7 +606,7 @@ func (t *FilesystemTool) handleSearchFilesContent(_ context.Context, args Search
606606
// Check exclude patterns against relative path from search root
607607
relPath, err := filepath.Rel(resolvedPath, path)
608608
if err != nil {
609-
return nil //nolint:nilerr // skip paths that can't be made relative
609+
return nil
610610
}
611611

612612
for _, exclude := range args.ExcludePatterns {
@@ -625,7 +625,7 @@ func (t *FilesystemTool) handleSearchFilesContent(_ context.Context, args Search
625625

626626
content, err := os.ReadFile(path)
627627
if err != nil {
628-
return nil //nolint:nilerr // skip unreadable files
628+
return nil
629629
}
630630

631631
lines := strings.Split(string(content), "\n")

pkg/tools/codemode/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (c *codeModeTool) runJavascript(ctx context.Context, script string) (Script
6666
v, err := vm.RunString(script)
6767
if err != nil {
6868
// Script execution failed - include tool call history to help LLM understand what went wrong
69-
return ScriptResult{ //nolint:nilerr // script errors are returned as data, not Go errors
69+
return ScriptResult{
7070
StdOut: stdOut.String(),
7171
StdErr: stdErr.String(),
7272
Value: err.Error(),

pkg/tools/mcp/mcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func (ts *Toolset) Stop(ctx context.Context) error {
243243

244244
if err := ts.mcpClient.Close(context.WithoutCancel(ctx)); err != nil {
245245
if ctx.Err() != nil {
246-
return nil //nolint:nilerr // close error expected when context already cancelled
246+
return nil
247247
}
248248
slog.Error("Failed to stop MCP toolset", "server", ts.logID, "error", err)
249249
return err

0 commit comments

Comments
 (0)