Closed armondressler closed 1 year ago
Ditto here, same problem.
Environment: Windows 11 x64 Go 1.20.3 Buffalo 0.18.14
$ buffalo new test-app
$ cd test-app
$ buffalo generate resource Items name:string
$ buffalo pop create
$ buffalo pop migrate
$ buffalo dev
Navigate to `http://localhost:3000/items/new
Observe error as described in @armondressler's report above
I believe the root cause is the use of filepath.Join in the context of fs.FS
with Windows using forward slash vs back slash. A similar issue was discussed here with the explanation:
The io/fs.FS package uses forward slashes for filenames, even on Windows. See https://golang.org/pkg/io/fs/#ValidPath:
"Note that paths are slash-separated on all systems, even Windows."
You should use path.Join, not filepath.Join for embed filenames.
Originally posted by @eliasnaur in https://github.com/golang/go/issues/44305#issuecomment-780111748
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.
This is related to how go:embed works. With go embed, files starting with "." and "_" are ignored. Which means, they are not available in the binary.
Check: https://pkg.go.dev/embed
To fix this, you can update the public/embed.go
and apply this change:
- //go:embed */* *
+ //go:embed all:*/* all:*
@fsniper that is not correct. See my above comment and the linked issues. It is a problem with using filepath.Join
vs path.Join
under Windows.
@saurori I can't speak for windows, but I had to fix this on OSX just 2 days ago. And this was my solution.
I suppose my case was totally unrelated. I used a public/partials
directory which does not refer to any action.
@fsniper what you described with go:embed I also ran into on macOS (has to do with go:embed prior to go 1.18 and files starting with _
). But I believe the issue in this thread and other linked issues has to do with back slash vs forward slash behavior on Windows when using filepath.Join
.
I am on go version go1.20.4 darwin/amd64. Perhaps there are 2 separate issues at play here.
I checked the test case and it's working on my configuration. So my situation is unrelated.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.
This issue was closed because it has been stalled for 30+7 days with no activity.
Description
My goal is to use the partials feature as described in the documentation. Using buffalo v0.18.14
Description
When trying to use the partials as described in https://gobuffalo.io/documentation/frontend-layer/partials/, buffalo returns with a 500 and gives the following error:
users/new.html: line 2: could not call partial function: could not find template users/_form.html
As described in the documentation i added an action "users" (new), the templates/users directory contains the following files:
form.plush.html:
new.plush.html:
Expected Behavior
users/new should render the partial instead of throwing an error.
Actual Behavior
users/new.html: line 2: could not call partial function: could not find template users/_form.html
To Reproduce
No response
Additional Context
The renderer seems to be working in general. The example from https://gobuffalo.io/pt/documentation/frontend-layer/rendering/#markdown works as intended.