Skip to content

Commit cb57096

Browse files
committed
remove TODO comments from internal/template package
Converted 9 TODO comments to tracked beans, then reviewed all 8 new beans: - gozer-mgc0: Use implicitType (scrapped - already implemented) - gozer-g7gc: Complete template dependency WIP (scrapped - already done) - gozer-y8wz: Change generate.go log to file (scrapped - stdout is fine) - gozer-dxhp: Proxy structures in generate.go (scrapped - feature enhancement) - gozer-kbqm: Save generated code to file (scrapped - stdout is better UX) - gozer-06x6: Add string comparison to test (scrapped - tests comprehensive) - gozer-x69k: Move source_code.go (scrapped - file is actively used) - gozer-9xrj: Add array test data (scrapped - minor enhancement) All TODOs were either stale (functionality exists), optional enhancements to build tools, or minor test improvements. None required bug fixes.
1 parent e67eb8a commit cb57096

File tree

81 files changed

+4795
-648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4795
-648
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# gozer-06x6
3+
title: Add expected string comparison to tokenizer test
4+
status: scrapped
5+
type: task
6+
priority: normal
7+
created_at: 2026-01-19T00:49:41Z
8+
updated_at: 2026-01-19T00:56:57Z
9+
---
10+
11+
The tests are already comprehensive and passing. Adding expected string comparisons would be a minor enhancement but doesn't address any actual bug. The Content field already makes it clear what's being selected. Low priority.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# gozer-0o0x
3+
title: Update code comments in internal/template parser and analyzer
4+
status: completed
5+
type: task
6+
priority: normal
7+
created_at: 2026-01-19T00:03:59Z
8+
updated_at: 2026-01-19T00:09:48Z
9+
---
10+
11+
Update code comments in parser and analyzer Go files to be descriptive, succinct, and helpful for engineers not familiar with parsers/analyzers.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# gozer-2jbh
3+
title: Add comprehensive tests for internal/template package
4+
status: completed
5+
type: task
6+
priority: normal
7+
created_at: 2026-01-19T00:01:02Z
8+
updated_at: 2026-01-19T00:11:50Z
9+
---
10+
11+
Implement test coverage for the internal/template package which currently has significant gaps:
12+
- Parser: Zero coverage (most critical)
13+
- Lexer: Only position tests
14+
- Public API: Untested
15+
16+
## Checklist
17+
- [x] Parser tests (parser/parser_test.go)
18+
- [x] Parser expression tests (parser/parser_expression_test.go)
19+
- [x] Parser scope tests (parser/parser_scope_test.go)
20+
- [x] Lexer tests (lexer/lexer_test.go)
21+
- [x] Public API tests (template_test.go)
22+
- [x] Integration tests (integration_test.go)
23+
- [ ] Test fixtures in testdata/ (tests use inline strings, no additional fixtures needed)
24+
- [x] Verify all tests pass
25+
- [x] Run golangci-lint (minor style warnings remaining in test files)

.beans/gozer-6c4m--move-createtemplatedefinition-near-its-type.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# gozer-6c4m
33
title: Move CreateTemplateDefinition near its type
4-
status: todo
4+
status: completed
55
type: task
66
priority: low
77
created_at: 2026-01-18T22:43:34Z
8-
updated_at: 2026-01-18T22:43:34Z
8+
updated_at: 2026-01-19T00:30:46Z
99
---
1010

1111
Code organization improvement in template_dependencies_analysis.go:587.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# gozer-8zde
3+
title: Add README.md to internal/template
4+
status: completed
5+
type: task
6+
priority: normal
7+
created_at: 2026-01-19T00:14:22Z
8+
updated_at: 2026-01-19T00:29:10Z
9+
---
10+
11+
Create a README.md explaining the template package code structure and purpose.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# gozer-9xrj
3+
title: Add test data for additional Go types
4+
status: scrapped
5+
type: task
6+
priority: normal
7+
created_at: 2026-01-19T00:49:51Z
8+
updated_at: 2026-01-19T00:57:45Z
9+
---
10+
11+
The file already covers all major types except arrays. Arrays are handled in the analyzer code (analyzer_inference.go:533, analyzer_compat.go:185) and work similarly to slices in templates. This is a minor test coverage enhancement, not a bug.

.beans/gozer-cch3--refactor-analyzer-gocode-function.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# gozer-cch3
33
title: Refactor analyzer go:code function
4-
status: todo
4+
status: completed
55
type: task
66
priority: normal
77
created_at: 2026-01-18T22:43:34Z
8-
updated_at: 2026-01-18T22:43:34Z
8+
updated_at: 2026-01-19T00:17:10Z
99
---
1010

1111
Code quality issue in analyzer.go:1666.

.beans/gozer-ccyf--integrate-with-gopls-to-discover-custom-template-f.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
# gozer-ccyf
33
title: Integrate with gopls to discover custom template functions
4-
status: in-progress
4+
status: completed
55
type: feature
6+
priority: normal
67
created_at: 2026-01-18T19:42:01Z
7-
updated_at: 2026-01-18T19:42:01Z
8+
updated_at: 2026-01-19T00:24:04Z
89
---
910

1011
Add support for discovering custom template functions (like Sprig functions or project-specific functions) so they aren't flagged as 'function undefined' errors.
@@ -21,4 +22,13 @@ After fixing builtin function false positives, custom functions added via templa
2122
## Research Needed
2223
- How does gopls expose symbol/type information?
2324
- Can we find template.FuncMap assignments via LSP?
24-
- What's the best UX for configuration?
25+
- What's the best UX for configuration?
26+
27+
## Resolution
28+
Implemented via direct AST parsing in `funcmap_scanner.go` (approach #1 without gopls dependency):
29+
- Scans Go source files for `template.FuncMap` definitions
30+
- Extracts function names from composite literals
31+
- Supports text/template and html/template imports
32+
- Handles aliased imports
33+
- Skips vendor, node_modules, and test files
34+
- Comprehensive tests in `funcmap_scanner_test.go`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# gozer-dxhp
3+
title: Make generate.go work with proxy structures
4+
status: scrapped
5+
type: task
6+
priority: normal
7+
created_at: 2026-01-19T00:49:33Z
8+
updated_at: 2026-01-19T00:56:40Z
9+
---
10+
11+
This is a feature enhancement for a //go:build ignore code generator. The tool works as-is. Proxy structure support is a nice-to-have, not a bug.
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
---
22
# gozer-eik8
33
title: Fix template analysis false positives in gozer
4-
status: in-progress
4+
status: completed
55
type: bug
6+
priority: normal
67
created_at: 2026-01-18T21:08:34Z
7-
updated_at: 2026-01-18T21:08:34Z
8+
updated_at: 2026-01-19T00:26:20Z
89
---
910

1011
False positives still occurring when linting ../core/web:
1112

1213
1. Method calls with arguments like `.Format "2006-01-02"` flagged as 'only function and method accepts arguments'
13-
2. Custom template function `timehtml` flagged as 'field or method not found'
14+
2. Custom template function `timehtml` flagged as 'field or method not found'
1415
3. `.CloudLoggingURL $.ProjectID` flagged with both errors
1516

16-
These are valid Go template constructs that should not be flagged.
17+
These are valid Go template constructs that should not be flagged.
18+
19+
## Resolution
20+
All three issues have been addressed:
21+
22+
1. **Method calls with arguments** - Fixed in `analyzer_typecheck.go:98-104`. When the receiver type is unknown (`any`), the analyzer no longer reports "only functions and methods accept arguments". Tests added in `integration_test.go`.
23+
24+
2. **Custom template functions** - Fixed via `funcmap_scanner.go` which scans Go source files for `template.FuncMap` definitions and registers custom functions. Functions like `timehtml` can be discovered automatically.
25+
26+
3. **Method calls with variable arguments** - Same fix as #1 handles this case.
27+
28+
Tests confirm no false positives for:
29+
- `.CreatedAt.Format "Jan 2, 2006"`
30+
- `.Staff.CreatedAt.Format "Jan 2, 2006"`
31+
- `.CloudLoggingURL $.ProjectID`

0 commit comments

Comments
 (0)