You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is probably an unexpected situation due to unclosed brackets that trigger excessive CPU and memory usage in templ fmt and templ generate.
I have a templ component defined as
templSplitRule(usertypes.GroupMember, members []types.GroupMember)
When I call it in another templ file but accidentally forget to close the brackets like:
@SplitRule(types.GroupMember{
UserID: uuid.NewString(),
Username: "user me",
}, []types.GroupMember{
{
UserID: uuid.NewString(),
Username: "user 1",
},
// }) <------ should be here but I accidentally forget
There are two cases that can trigger the excessive CPU and memory usage:
save the code in VSCode and trigger templ fmt
resolve: disable/uninstall templ-vscode vscode plugin and reload vscode
use templ generate
resolve: kill terminal process
Both of the 2 latest versions can reproduce the problem.
Just in case you want to reproduce it, here is the repo and here is the file
Snapshots
top -i output,
templ generate -v output
templ info output
(✓) os [ goos=linux goarch=amd64 ]
(✓) go [ location=/usr/local/go/bin/go version=go version go1.23.3 linux/amd64 ]
(✓) gopls [ location=/home/cykuotw/go/bin/gopls version=golang.org/x/tools/gopls v0.16.2 ]
(✓) templ [ location=/home/cykuotw/go/bin/templ version=v0.2.793 ]
Desktop:
OS: WSL Ubuntu 20.04.6 LTS
templ CLI version: v0.2.793
Go version: go1.23.3 linux/amd64
gopls version: golang.org/x/tools/gopls v0.16.2
The text was updated successfully, but these errors were encountered:
There is probably an unexpected situation due to unclosed brackets that trigger excessive CPU and memory usage in
templ fmt
andtempl generate
.I have a templ component defined as
When I call it in another templ file but accidentally forget to close the brackets like:
There are two cases that can trigger the excessive CPU and memory usage:
templ fmt
templ-vscode
vscode plugin and reload vscodetempl generate
Both of the 2 latest versions can reproduce the problem.
Just in case you want to reproduce it, here is the repo and here is the file
Snapshots
top -i
output,templ generate -v
outputtempl info
outputDesktop:
gopls
version: golang.org/x/tools/gopls v0.16.2The text was updated successfully, but these errors were encountered: