From dc5c4d6a75395a85d930dc48be4acf1d3de52e23 Mon Sep 17 00:00:00 2001 From: Sycun <165354365+Sycun@users.noreply.github.com> Date: Wed, 7 Oct 2026 12:11:50 +0800 Subject: [PATCH] fix: build the server through the package, not one file The CLI now lives in two files (main.go and update_cli.go), so `go build cmd/server/main.go` compiles only main.go and leaves updateCommandIfNeeded undefined - which is exactly how run.sh (twice) and both READMEs built. `go build ./cmd/server` compiles the whole package; run.sh's rebuild check already scans internal/ and cmd/ for newer sources, so nothing else needed adjusting. --- README.md | 4 ++-- README_CN.md | 4 ++-- run.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2d0c3610..ad3385f0 100644 --- a/README.md +++ b/README.md @@ -256,10 +256,10 @@ The `run.sh` script will automatically: **Alternative Launch Methods:** ```bash # Direct Go run (set up env yourself); add --https to match run.sh defaults -go run cmd/server/main.go --https +go run ./cmd/server --https # Manual build -go build -o cyberstrike-ai cmd/server/main.go +go build -o cyberstrike-ai ./cmd/server ./cyberstrike-ai --https ``` diff --git a/README_CN.md b/README_CN.md index 9930b34f..5518897c 100644 --- a/README_CN.md +++ b/README_CN.md @@ -255,10 +255,10 @@ chmod +x run.sh && ./run.sh **其他启动方式:** ```bash # 直接运行(需自行配环境);与 run.sh 默认一致可加 --https -go run cmd/server/main.go --https +go run ./cmd/server --https # 手动编译 -go build -o cyberstrike-ai cmd/server/main.go +go build -o cyberstrike-ai ./cmd/server ./cyberstrike-ai --https ``` diff --git a/run.sh b/run.sh index 81e0df75..c58b6186 100755 --- a/run.sh +++ b/run.sh @@ -313,7 +313,7 @@ build_go_project() { ( set +e # disable errexit in subshell export GOPROXY="$GOPROXY" - go build -o "$BINARY_NAME" cmd/server/main.go >"$GO_BUILD_LOG" 2>&1 + go build -o "$BINARY_NAME" ./cmd/server >"$GO_BUILD_LOG" 2>&1 echo $? > "${GO_BUILD_LOG}.exit" ) & GO_BUILD_PID=$!