fix: move embed to repo root; make build sequential
- Move embed_prod.go/embed_dev.go out of cmd/wotra/ into root-level assets_prod.go / assets_dev.go (package assets). go:embed paths must be relative to the source file; cmd/wotra/ cannot reach ../../web/build. - Update cmd/wotra/main.go to import the root assets package. - Change mise.toml build task from parallel depends to sequential shell commands (build:web then build:go) so the frontend is always compiled before the Go embed runs.
This commit is contained in:
21
assets_prod.go
Normal file
21
assets_prod.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// assets_prod.go — used in production builds (requires web/build to exist)
|
||||
//go:build production
|
||||
|
||||
package assets
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
//go:embed all:web/build
|
||||
var embeddedWeb embed.FS
|
||||
|
||||
// FS is the sub-filesystem rooted at web/build.
|
||||
var FS fs.FS = func() fs.FS {
|
||||
sub, err := fs.Sub(embeddedWeb, "web/build")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return sub
|
||||
}()
|
||||
Reference in New Issue
Block a user