Skip to content

Commit b3cd229

Browse files
author
razvan
committed
chore: fix golangci-lint warnings in html, drain, and test files
1 parent d7b1c66 commit b3cd229

5 files changed

Lines changed: 11 additions & 33 deletions

File tree

cmd/rag-code-mcp/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
var (
19-
Version = "2.1.79"
19+
Version = "2.1.80"
2020
Commit = "none"
2121
Date = "24.10.2025"
2222
)

internal/adapter/adapter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestRunBridge(t *testing.T) {
2828
hitCount++
2929
w.Header().Set("Content-Type", "application/json")
3030
// Echo it to prove it hit the server
31-
w.Write([]byte(`{"jsonrpc":"2.0", "result": ` + string(body) + `}`))
31+
_, _ = w.Write([]byte(`{"jsonrpc":"2.0", "result": ` + string(body) + `}`))
3232
}))
3333
server.Start()
3434
defer server.Close()

pkg/parser/arenagc/drain.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
// Only the fields we need to access (mu + free) are declared.
1717
type nodeArenaPool struct {
1818
mu sync.Mutex
19-
class uint8
20-
maxSize int
19+
_ uint8 // class
20+
_ int // maxSize
2121
free []*struct{} // opaque; we just need to nil the slice
2222
}
2323

pkg/parser/html/analyzer.go

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,24 @@ import (
88
"os"
99
"path/filepath"
1010
"strings"
11-
"sync"
12-
1311
"github.com/PuerkitoBio/goquery"
1412
pkgParser "github.com/doITmagic/rag-code-mcp/pkg/parser"
15-
"github.com/odvcencio/gotreesitter"
16-
"github.com/odvcencio/gotreesitter/grammars"
1713
)
1814

1915
func init() {
2016
pkgParser.Register(NewAnalyzer())
2117
}
2218

2319
// Analyzer implements the pkgParser.Analyzer interface for HTML.
24-
// Caches gotreesitter.Parser instances per language to avoid re-allocating expensive lookup tables.
2520
type Analyzer struct {
26-
ca *CodeAnalyzer
27-
mu sync.Mutex
28-
parsers map[string]*gotreesitter.Parser
21+
ca *CodeAnalyzer
2922
}
3023

3124
// NewAnalyzer creates a new HTML analyzer.
3225
func NewAnalyzer() *Analyzer {
3326
return &Analyzer{
34-
ca: NewCodeAnalyzer(),
35-
parsers: make(map[string]*gotreesitter.Parser),
36-
}
37-
}
38-
39-
func (a *Analyzer) getOrCreateParser(lang *grammars.LangEntry) *gotreesitter.Parser {
40-
a.mu.Lock()
41-
defer a.mu.Unlock()
42-
if cached, ok := a.parsers[lang.Name]; ok {
43-
return cached
27+
ca: NewCodeAnalyzer(),
4428
}
45-
p := gotreesitter.NewParser(lang.Language())
46-
a.parsers[lang.Name] = p
47-
return p
48-
}
49-
50-
// ReleaseResources drops cached tree-sitter parsers so the GC can
51-
// reclaim the arena memory they reference.
52-
func (a *Analyzer) ReleaseResources() {
53-
a.mu.Lock()
54-
defer a.mu.Unlock()
55-
a.parsers = make(map[string]*gotreesitter.Parser)
5629
}
5730

5831
// Name returns "html".

test.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
body {
3+
color: #fff;
4+
}
5+

0 commit comments

Comments
 (0)