//go:build !dev // Package web embeds the frontend build (web/dist, generated by pnpm build) in the Go binary. // Use -tags dev during development; Vite serves the frontend, as described in embed_dev.go. package web import ( "bytes" "embed" "fmt" "io/fs" ) //go:embed all:dist var dist embed.FS func Dist() fs.FS { sub, err := fs.Sub(dist, "dist") if err != nil { panic(err) // The compile-time constant path cannot fail. } return sub } // BuildVersion shares the page entry's build identifier and fails explicitly when production output is missing. func BuildVersion() (string, error) { html, err := fs.ReadFile(Dist(), "index.html") if err != nil { return "", err } marker := []byte(` 0 { return string(rest[:end]), nil } } return "", fmt.Errorf("缺少构建版本") }