fix: build tool from script directory (correct go.mod context)

This commit is contained in:
Claus Lohmar 2026-07-07 14:57:30 +01:00
parent 533b6f4137
commit 02bab22a5d

View file

@ -37,6 +37,7 @@ else
fi fi
# --- Common: pull + build --- # --- Common: pull + build ---
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$REPO_DIR" cd "$REPO_DIR"
echo "[1/6] Pulling latest code..." echo "[1/6] Pulling latest code..."
git pull git pull
@ -45,15 +46,10 @@ echo "[2/6] Building binary and helper tool..."
export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:/usr/local/go/bin
go build -o "$BINARY_NAME" . go build -o "$BINARY_NAME" .
# Build helper tool from script directory (has correct go.mod with all deps)
TOOL_BIN="/tmp/nextwks-tool" TOOL_BIN="/tmp/nextwks-tool"
TOOL_SRC="" TOOL_SRC="$SCRIPT_DIR/tools/nextwks-tool"
for TRY_DIR in "$REPO_DIR/tools/nextwks-tool" "$(dirname $0)/tools/nextwks-tool"; do if [ -d "$TOOL_SRC" ]; then
if [ -d "$TRY_DIR" ]; then
TOOL_SRC="$TRY_DIR"
break
fi
done
if [ -n "$TOOL_SRC" ]; then
cd "$TOOL_SRC" cd "$TOOL_SRC"
go build -o "$TOOL_BIN" . 2>&1 && echo "[OK] Helper tool built" || echo "[WARN] Helper tool build failed" go build -o "$TOOL_BIN" . 2>&1 && echo "[OK] Helper tool built" || echo "[WARN] Helper tool build failed"
cd "$REPO_DIR" cd "$REPO_DIR"