Repository navigation
fix: separate the templ version comment from the package clause - #1459
Merged
Merged
Conversation
…a-h#1457 The version and generated date comments were written directly above the package clause, so Go treated them as package documentation. A hand-written package comment in the same package then made linters such as godoclint report more than one package doc. Write a blank line after these comments when either is present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a-h
approved these changes
Oct 20, 2026
Owner
|
@copilot resolve the merge conflicts in this pull request |
Owner
|
Thanks good spot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
templ generatewrites// templ: version: ...(and// templ: generated: ...when a timestamp is requested) directly above thepackageclause, so Go treats these comments as package documentation. In a package that also has a hand-written package comment, golangci-lint'sgodoclintthen reports "package has more than one godoc" on the hand-written file, which generated-file exclusions don't suppress.This writes a blank line after the version/generated date comments when either is present, as suggested in the issue. Output without a version or timestamp (e.g.
-include-version=false) is unchanged, so none of the checked-in_templ.gofiles change.Fixes #1457
Testing
TestGeneratorVersionCommentIsNotPackageDocingenerator/generator_test.go: it generates code with a version (and with a version plus timestamp), parses the output withgo/parser, and asserts there is no package doc. It fails without the change.go run ./cmd/templ generate -include-version=falseproduces no diff;go test -short ./...passes;go vetandgolangci-lint run ./generator/...report no issues.This change was prepared with AI assistance (Claude Code).