fix: conditional client build
This commit is contained in:
parent
21cd91156c
commit
86b74e0ebc
@ -5,7 +5,7 @@ tmp_dir = "tmp"
|
||||
[build]
|
||||
args_bin = []
|
||||
bin = "./tmp/main"
|
||||
cmd = "go build -o ./tmp/main ."
|
||||
cmd = "go build -tags dev -o ./tmp/main ."
|
||||
delay = 1000
|
||||
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
||||
exclude_file = []
|
||||
|
@ -1,16 +1,24 @@
|
||||
// go:build !dev
|
||||
//go:build !dev
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed client
|
||||
//go:embed all:client
|
||||
var eclient embed.FS
|
||||
|
||||
func init() {
|
||||
fs := http.FS(eclient)
|
||||
log.Println("Initializing client for production")
|
||||
client, err := fs.Sub(eclient, "client")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to get client: %v", err)
|
||||
}
|
||||
|
||||
fs := http.FS(client)
|
||||
embedfs = &fs
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user