From d93157bde419b601a8bf756c13a6c3059c80888a Mon Sep 17 00:00:00 2001 From: josc146 Date: Tue, 30 May 2023 11:04:11 +0800 Subject: [PATCH] don't release embedded files in development mode --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 31dc6cf..bf79077 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,8 @@ package main import ( "embed" + "runtime/debug" + "strings" backend "rwkv-runner/backend-golang" @@ -23,9 +25,11 @@ var cyacInfo embed.FS var py embed.FS func main() { - backend.CopyEmbed(cyac) - backend.CopyEmbed(cyacInfo) - backend.CopyEmbed(py) + if buildInfo, ok := debug.ReadBuildInfo(); !ok || strings.Contains(buildInfo.String(), "-ldflags") { + backend.CopyEmbed(cyac) + backend.CopyEmbed(cyacInfo) + backend.CopyEmbed(py) + } // Create an instance of the app structure app := backend.NewApp()