-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generator: can't use iterator value in for loop #763
Comments
Oh, that's not right. I was surprised that this isn't covered in the test suites, but all of the tests use the empty value ( I suspect this issue was introduced when go expressions started being formatted, and the parser errors propagated. I won't be able to fix it until next weekend though. In the meantime, the classic 3 part for loop will work ( I think the fix will likely be to ignore unused variable errors during formatting operations, and leave any unused variable issues to be discovered in the generated output, but I'll have to look into it more. |
Thank you, great project by the way. I'll use the classic for loop for now. |
Hi @adonespitogo I'm taking a look at this. What version of templ are you using please? |
Second, what command are you running to see this error? Or is it in the editor? |
Hi @joerdav
|
I'm struggling to reproduce this, your original code is not valid templ so I couldn't just copy it into a file. I changed it into a valid templ file and couldn't get it to error:
Please can you consider creating a minimal reproducible example, either as a github repo or a single templ file that I can copy? |
Hi @joerdav I can no longer reproduce this issue. Perhaps it was a mistake on my part, a lot has changed in my code since then. Sorry for bringing this up. Feel free to close this issue. |
No problem, thanks for coming back to update! |
I can't use the
i
variable in this for loop example:Error:
The text was updated successfully, but these errors were encountered: