-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
refactor: update templ generate
to support pwd being a symlink
#858
Comments
Interesting. The templ/cmd/templ/generatecmd/watcher/watch.go Lines 38 to 55 in a48e910
WalkDir's docs state that it doesn't follow symbolic links: https://pkg.go.dev/path/filepath#WalkDir but without explanation. The explanation is provided in golang/go#4759 (comment) where it's noted that following symlinks could result in a traversal that loops and therefore never finishes. However, I note that So, I think that it's likely that replacing |
This is a good first issue for someone to pick up. The hardest part of this is testing - an integration test would need to run a templ generate out of a symlinked folder. The https://github.com/a-h/templ/tree/main/cmd/templ/testproject package provides a way to run integration tests on a sample project. If you see where that's used in the code, you can find some examples. Otherwise, I'll get to this when I get to it... |
Until it’s fixed, in case anyone else is having trouble with this – you could add |
templ generate
doesn't work if pwd is a symlinktempl generate
to support pwd being a symlink
Before you begin
Done.
Describe the bug
templ generate
does not work when the current directory is accessed via a symlink.To Reproduce
https://github.com/mlhetland/templ-symlink-bug
To reproduce:
Expected behavior
The appropriate
…_templ.go
file should be generated.Screenshots
templ info
outputDoesn't seem to be a recognized command? Anyway, the output is:
Desktop (please complete the following information):
gopls
version: golang.org/x/tools/gopls v0.16.1Additional context
Add any other context about the problem here.
One can see a bit more about what happens by running
templ generate -v
in both the symlinked directory and the actual directory:The text was updated successfully, but these errors were encountered: