run.sh: 非交互 shell 自动补充 Go PATH
This commit is contained in:
1 parent
ac69ae75d4
commit
9649167c83
1 file changed
+14
@@ -121,6 +121,7 @@ rotate_log() {
|
|||||||
# 后端服务(本地开发模式)
|
# 后端服务(本地开发模式)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
start_backend() {
|
start_backend() {
|
||||||
|
ensure_go_path || return 1
|
||||||
info "启动后端服务..."
|
info "启动后端服务..."
|
||||||
cd "$SCRIPT_DIR/$BACKEND_DIR"
|
cd "$SCRIPT_DIR/$BACKEND_DIR"
|
||||||
mkdir -p logs
|
mkdir -p logs
|
||||||
@@ -411,8 +412,21 @@ websocket:
|
|||||||
YAML
|
YAML
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 非交互 shell 常缺 Go PATH,补充常见安装目录 // Logan.Li
|
||||||
|
ensure_go_path() {
|
||||||
|
if command -v go &>/dev/null; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
export PATH="/usr/local/go/bin:$HOME/go/bin:/usr/lib/go/bin:$PATH"
|
||||||
|
if ! command -v go &>/dev/null; then
|
||||||
|
error "Go 未安装或不在 PATH,请先安装 Go 1.24+"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# 编译独立二进制(含 embed 前端)// Logan.Li
|
# 编译独立二进制(含 embed 前端)// Logan.Li
|
||||||
build_standalone_binary() {
|
build_standalone_binary() {
|
||||||
|
ensure_go_path || return 1
|
||||||
build_frontend_embed
|
build_frontend_embed
|
||||||
ensure_binary_config
|
ensure_binary_config
|
||||||
clean_go_artifacts
|
clean_go_artifacts
|
||||||
|
|||||||
Reference in new issue
Block a user