fix: start.sh detects embedded web file changes; rebuild on JS/CSS change

This commit is contained in:
jackyu66git
2026-05-04 00:09:49 +08:00
parent 004ff50325
commit e04a165d69
+1 -2
View File
@@ -30,8 +30,7 @@ if ss -tlnp 2>/dev/null | grep -q ":$PORT "; then
fi
# 编译(如果源码或嵌入文件有变更)
WEB_FILES=$(find web/static -name '*.html' -o -name '*.js' -o -name '*.css' 2>/dev/null)
if [ ! -x "$BIN" ] || [ -n "$(find . -name '*.go' $WEB_FILES -newer "$BIN" 2>/dev/null | head -1)" ]; then
if [ ! -x "$BIN" ] || [ -n "$(find . -name '*.go' -newer "$BIN" 2>/dev/null | head -1)" ] || [ -n "$(find web/static -newer "$BIN" 2>/dev/null | head -1)" ]; then
echo "[start] 编译新二进制..."
go build -o "$BIN" . 2>&1
fi