Giter Site home page Giter Site logo

Comments (12)

saurori avatar saurori commented on June 2, 2024 1

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 golang/go#44305 (comment)

from buffalo.

fritzhu avatar fritzhu commented on June 2, 2024

Ditto here, same problem.

Environment:
Windows 11 x64
Go 1.20.3
Buffalo 0.18.14

To reproduce

  1. Create and run test app
$ buffalo new test-app
$ cd test-app
$ buffalo generate resource Items name:string
$ buffalo pop create
$ buffalo pop migrate
$ buffalo dev
  1. Navigate to `http://localhost:3000/items/new

  2. Observe error as described in @armondressler's report above

from buffalo.

github-actions avatar github-actions commented on June 2, 2024

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.

from buffalo.

fsniper avatar fsniper commented on June 2, 2024

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:*

from buffalo.

saurori avatar saurori commented on June 2, 2024

@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.

from buffalo.

fsniper avatar fsniper commented on June 2, 2024

@saurori I can't speak for windows, but I had to fix this on OSX just 2 days ago. And this was my solution.

from buffalo.

fsniper avatar fsniper commented on June 2, 2024

I suppose my case was totally unrelated. I used a public/partials directory which does not refer to any action.

from buffalo.

saurori avatar saurori commented on June 2, 2024

@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.

from buffalo.

fsniper avatar fsniper commented on June 2, 2024

I am on go version go1.20.4 darwin/amd64. Perhaps there are 2 separate issues at play here.

from buffalo.

fsniper avatar fsniper commented on June 2, 2024

I checked the test case and it's working on my configuration. So my situation is unrelated.

from buffalo.

github-actions avatar github-actions commented on June 2, 2024

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.

from buffalo.

github-actions avatar github-actions commented on June 2, 2024

This issue was closed because it has been stalled for 30+7 days with no activity.

from buffalo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.