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