@@ -230,6 +230,142 @@ import { MyClass } from './lib';
230230]
231231```
232232
233+ ### Example 3: Scanning Go Files
234+
235+ ** Input:** ` server/handler.go `
236+ ``` go
237+ package server
238+
239+ // Handler processes incoming requests.
240+ type Handler struct {
241+ name string
242+ }
243+
244+ // NewHandler creates a new Handler instance.
245+ func NewHandler (name string ) *Handler {
246+ return &Handler{name: name}
247+ }
248+
249+ // Process handles a request and returns a response.
250+ func (h *Handler ) Process (req Request ) (Response , error ) {
251+ // processing logic
252+ return Response{}, nil
253+ }
254+
255+ // Stack is a generic stack data structure.
256+ type Stack [T any] struct {
257+ items []T
258+ }
259+
260+ // Push adds an item to the stack.
261+ func (s *Stack [T ]) Push (item T ) {
262+ s.items = append (s.items , item)
263+ }
264+ ```
265+
266+ ** Output:**
267+ ``` json
268+ [
269+ {
270+ "id" : " server/handler.go:Handler:4" ,
271+ "text" : " struct Handler\n type Handler struct\n Handler processes incoming requests." ,
272+ "type" : " class" ,
273+ "language" : " go" ,
274+ "metadata" : {
275+ "file" : " server/handler.go" ,
276+ "startLine" : 4 ,
277+ "endLine" : 6 ,
278+ "name" : " Handler" ,
279+ "signature" : " type Handler struct" ,
280+ "exported" : true ,
281+ "docstring" : " Handler processes incoming requests."
282+ }
283+ },
284+ {
285+ "id" : " server/handler.go:NewHandler:9" ,
286+ "text" : " function NewHandler\n func NewHandler(name string) *Handler\n NewHandler creates a new Handler instance." ,
287+ "type" : " function" ,
288+ "language" : " go" ,
289+ "metadata" : {
290+ "file" : " server/handler.go" ,
291+ "startLine" : 9 ,
292+ "endLine" : 11 ,
293+ "name" : " NewHandler" ,
294+ "signature" : " func NewHandler(name string) *Handler" ,
295+ "exported" : true ,
296+ "docstring" : " NewHandler creates a new Handler instance."
297+ }
298+ },
299+ {
300+ "id" : " server/handler.go:Handler.Process:14" ,
301+ "text" : " method Handler.Process\n func (h *Handler) Process(req Request) (Response, error)\n Process handles a request and returns a response." ,
302+ "type" : " method" ,
303+ "language" : " go" ,
304+ "metadata" : {
305+ "file" : " server/handler.go" ,
306+ "startLine" : 14 ,
307+ "endLine" : 17 ,
308+ "name" : " Handler.Process" ,
309+ "signature" : " func (h *Handler) Process(req Request) (Response, error)" ,
310+ "exported" : true ,
311+ "docstring" : " Process handles a request and returns a response." ,
312+ "custom" : {
313+ "receiver" : " Handler" ,
314+ "receiverPointer" : true
315+ }
316+ }
317+ },
318+ {
319+ "id" : " server/handler.go:Stack:20" ,
320+ "text" : " struct Stack\n type Stack[T any] struct\n Stack is a generic stack data structure." ,
321+ "type" : " class" ,
322+ "language" : " go" ,
323+ "metadata" : {
324+ "file" : " server/handler.go" ,
325+ "startLine" : 20 ,
326+ "endLine" : 22 ,
327+ "name" : " Stack" ,
328+ "signature" : " type Stack[T any] struct" ,
329+ "exported" : true ,
330+ "docstring" : " Stack is a generic stack data structure." ,
331+ "custom" : {
332+ "isGeneric" : true ,
333+ "typeParameters" : [" T any" ]
334+ }
335+ }
336+ },
337+ {
338+ "id" : " server/handler.go:Stack.Push:25" ,
339+ "text" : " method Stack.Push\n func (s *Stack[T]) Push(item T)\n Push adds an item to the stack." ,
340+ "type" : " method" ,
341+ "language" : " go" ,
342+ "metadata" : {
343+ "file" : " server/handler.go" ,
344+ "startLine" : 25 ,
345+ "endLine" : 27 ,
346+ "name" : " Stack.Push" ,
347+ "signature" : " func (s *Stack[T]) Push(item T)" ,
348+ "exported" : true ,
349+ "docstring" : " Push adds an item to the stack." ,
350+ "custom" : {
351+ "receiver" : " Stack" ,
352+ "receiverPointer" : true ,
353+ "isGeneric" : true
354+ }
355+ }
356+ }
357+ ]
358+ ```
359+
360+ ** Go Scanner Features:**
361+ - Functions, methods, structs, interfaces, type aliases
362+ - Doc comments (Go-style ` // ` comments preceding declarations)
363+ - Receiver method extraction with pointer/value distinction
364+ - Go generics (Go 1.18+) with type parameter tracking
365+ - Exported/unexported detection (capitalization)
366+ - Generated file skipping (` // Code generated ` header)
367+ - Test file detection (` *_test.go ` → ` isTest: true ` )
368+
233369### Example 3: Full Repository Scan
234370
235371``` typescript
@@ -374,7 +510,7 @@ const utilDocs = result.documents.filter(
374510| TypeScript | ` TypeScriptScanner ` | Functions, classes, methods, interfaces, types, arrow functions, exported constants, JSDoc | ✅ Implemented |
375511| JavaScript | ` TypeScriptScanner ` | Functions, classes, methods, arrow functions, exported constants, JSDoc | ✅ Implemented (via .ts scanner) |
376512| Markdown | ` MarkdownScanner ` | Documentation sections, code blocks | ✅ Implemented |
377- | Go | - | Functions, structs, interfaces | 🔄 Planned (tree-sitter) |
513+ | Go | ` GoScanner ` | Functions, methods, structs, interfaces, types, constants, generics, doc comments | ✅ Implemented (tree-sitter) |
378514| Python | - | Functions, classes, docstrings | 🔄 Planned (tree-sitter) |
379515| Rust | - | Functions, structs, traits | 🔄 Planned (tree-sitter) |
380516
@@ -490,7 +626,9 @@ registry.register(new GoScanner());
490626- [x] TypeScript scanner with ts-morph
491627- [x] Markdown scanner with remark
492628- [x] Scanner registry and auto-detection
493- - [ ] Tree-sitter integration for Go, Python, Rust
629+ - [x] Go scanner with tree-sitter (functions, methods, structs, interfaces, generics)
630+ - [ ] Python scanner with tree-sitter
631+ - [ ] Rust scanner with tree-sitter
494632- [ ] Enhanced JavaScript support (JSX, Flow)
495633- [ ] Configuration file support
496634- [ ] Incremental scanning (hash-based)
0 commit comments