Skip to content

Commit 7f5a076

Browse files
committed
chore: add golangci-lint config and fix resource lint issue
- Add .golangci.yml with a pragmatic core-linter set (errcheck, gosimple, govet, ineffassign, staticcheck, unused). Test files are excluded from the noisiest rules; pre-existing production findings are explicitly excluded with comments so they can be removed incrementally. - Fix the lint issue in internal/resource/resource.go (unchecked filepath.WalkDir error). The CI workflow job will be added separately because this token lacks the workflow OAuth scope.
1 parent e581503 commit 7f5a076

2 files changed

Lines changed: 179 additions & 1 deletion

File tree

.golangci.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# golangci-lint configuration for odek.
2+
#
3+
# Goal: enable a core set of linters in CI without requiring a one-shot
4+
# refactor of the whole codebase. Test files are excluded from the noisiest
5+
# rules (errcheck, unused) because setup helpers frequently ignore errors or
6+
# are conditionally compiled. Pre-existing production issues are listed below
7+
# with explicit excludes so CI stays green; they should be removed as the code
8+
# is touched.
9+
run:
10+
timeout: 10m
11+
go: "1.24"
12+
13+
linters:
14+
enable:
15+
- errcheck
16+
- gosimple
17+
- govet
18+
- ineffassign
19+
- staticcheck
20+
- unused
21+
22+
linters-settings:
23+
errcheck:
24+
# Ignore common error-delegation patterns where the error is handled
25+
# implicitly (e.g. fmt.Fprintf to stderr).
26+
exclude-functions:
27+
- fmt.Fprintf
28+
- fmt.Fprintln
29+
- io.WriteString
30+
31+
issues:
32+
exclude-rules:
33+
# Test helpers commonly ignore setup errors, may define conditionally unused
34+
# helpers, and often contain intentionally empty branches / identical
35+
# comparison assertions. Keep govet enabled for tests; silence the rest.
36+
- path: _test\.go
37+
linters:
38+
- errcheck
39+
- gosimple
40+
- ineffassign
41+
- staticcheck
42+
- unused
43+
44+
# ------------------------------------------------------------------
45+
# Pre-existing production issues to be fixed incrementally. Each entry
46+
# points to a concrete lint finding that existed before golangci-lint
47+
# was enabled in CI. Contributors should remove the matching exclude
48+
# when fixing the underlying code.
49+
# ------------------------------------------------------------------
50+
51+
# cmd/odek/file_tool.go: unchecked filepath.Walk errors.
52+
- path: cmd/odek/file_tool.go
53+
linters:
54+
- errcheck
55+
56+
# cmd/odek/main.go: unchecked fmt.Sscanf/Scanf/store.Save/sl.RecordSkip.
57+
- path: cmd/odek/main.go
58+
linters:
59+
- errcheck
60+
61+
# cmd/odek/mcp.go: unchecked error return.
62+
- path: cmd/odek/mcp.go
63+
linters:
64+
- errcheck
65+
66+
# cmd/odek/perf_tools.go: unchecked Walk/Seek/io.Copy/Process.Kill.
67+
- path: cmd/odek/perf_tools.go
68+
linters:
69+
- errcheck
70+
71+
# cmd/odek/repl.go: unchecked store.Save.
72+
- path: cmd/odek/repl.go
73+
linters:
74+
- errcheck
75+
76+
# cmd/odek/repl_editor.go: unchecked terminal restore/read.
77+
- path: cmd/odek/repl_editor.go
78+
linters:
79+
- errcheck
80+
81+
# cmd/odek/serve.go: unchecked error returns + unused wsStreamWriter.
82+
- path: cmd/odek/serve.go
83+
linters:
84+
- errcheck
85+
- unused
86+
87+
# cmd/odek/telegram.go: unchecked bot.* and os.MkdirAll error returns.
88+
- path: cmd/odek/telegram.go
89+
linters:
90+
- errcheck
91+
92+
# cmd/odek/wsapprover.go: unchecked rand.Read error.
93+
- path: cmd/odek/wsapprover.go
94+
linters:
95+
- errcheck
96+
97+
# cmd/odek/subagent.go: unchecked enc.Encode.
98+
- path: cmd/odek/subagent.go
99+
linters:
100+
- errcheck
101+
102+
# cmd/odek/vision_tool.go: unchecked fmt.Sscanf.
103+
- path: cmd/odek/vision_tool.go
104+
linters:
105+
- errcheck
106+
107+
# internal/memory/memory.go: unchecked episode write.
108+
- path: internal/memory/memory.go
109+
linters:
110+
- errcheck
111+
112+
# internal/skills/cache.go/tools.go/types.go: unchecked Rename/Unmarshal.
113+
- path: internal/skills/cache.go
114+
linters:
115+
- errcheck
116+
- path: internal/skills/tools.go
117+
linters:
118+
- errcheck
119+
- path: internal/skills/types.go
120+
linters:
121+
- errcheck
122+
123+
# internal/flock/flock.go: unchecked unlockFile.
124+
- path: internal/flock/flock.go
125+
linters:
126+
- errcheck
127+
128+
# internal/telegram/approver.go: unchecked EditMessageText/rand.Read.
129+
- path: internal/telegram/approver.go
130+
linters:
131+
- errcheck
132+
133+
# internal/telegram/health.go: unchecked json.Encode.
134+
- path: internal/telegram/health.go
135+
linters:
136+
- errcheck
137+
138+
# internal/llm/client.go: unused var + empty branch.
139+
- path: internal/llm/client.go
140+
linters:
141+
- unused
142+
- staticcheck
143+
144+
# internal/loop/loop.go: unnecessary fmt.Sprintf.
145+
- path: internal/loop/loop.go
146+
linters:
147+
- gosimple
148+
149+
# internal/mcpclient/client.go: unused type/fields/function + unchecked Wait/Kill.
150+
- path: internal/mcpclient/client.go
151+
linters:
152+
- errcheck
153+
- unused
154+
155+
# internal/memory/buffer.go: unnecessary fmt.Sprintf.
156+
- path: internal/memory/buffer.go
157+
linters:
158+
- gosimple
159+
160+
# internal/memory/memory.go: unused const.
161+
- path: internal/memory/memory.go
162+
linters:
163+
- unused
164+
165+
# internal/memory/merge.go: ineffectual assignments.
166+
- path: internal/memory/merge.go
167+
linters:
168+
- ineffassign
169+
170+
# internal/telegram/bot.go: deprecated netErr.Temporary.
171+
- path: internal/telegram/bot.go
172+
linters:
173+
- staticcheck
174+
175+
# internal/schedule/store.go: unchecked syscall.Flock.
176+
- path: internal/schedule/store.go
177+
linters:
178+
- errcheck

internal/resource/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func (f *FileResolver) walkAndMatch(searchTerm string) []string {
330330
base := f.root
331331

332332
var results []string
333-
filepath.WalkDir(base, func(path string, d os.DirEntry, err error) error {
333+
_ = filepath.WalkDir(base, func(path string, d os.DirEntry, err error) error {
334334
if err != nil {
335335
return nil
336336
}

0 commit comments

Comments
 (0)