fix: conditional client build

This commit is contained in:
trev 2025-03-18 17:41:29 -04:00
parent 21cd91156c
commit 86b74e0ebc
2 changed files with 12 additions and 4 deletions

View File

@ -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 = []

View 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
}