diff --git a/.air.toml b/.air.toml index bdc67c1ba..851f0bc27 100644 --- a/.air.toml +++ b/.air.toml @@ -5,7 +5,7 @@ root = "." tmp_dir = "tmp" [build] - bin = "./tmp/skillshare" + entrypoint = "./cmd/skillshare" cmd = "go build -o ./tmp/skillshare ./cmd/skillshare" # SKILLSHARE_UI_EXEC_PREFIX: optional prefix for the run command (e.g., "cd /path && /workspace/" # to change cwd while keeping the binary path absolute). Empty by default. diff --git a/.devcontainer/bin/ui b/.devcontainer/bin/ui index 55686a4b2..6e2e49428 100755 --- a/.devcontainer/bin/ui +++ b/.devcontainer/bin/ui @@ -80,7 +80,18 @@ export SKILLSHARE_UI_FLAGS="${MODE_FLAG} --port ${PORT}" if [ "$MODE" = "project" ]; then export SKILLSHARE_UI_EXEC_PREFIX="cd $HOME/demo-project && /workspace/" fi -nohup /usr/local/go/bin/air -c /workspace/.air.toml > "$LOGDIR/api-dev.log" 2>&1 & +# Resolve air binary (go install puts it in GOPATH/bin, not GOROOT/bin). +AIR_BIN="" +for p in "$(go env GOPATH)/bin/air" /go/bin/air /usr/local/go/bin/air; do + [ -x "$p" ] && AIR_BIN="$p" && break +done +if [ -z "$AIR_BIN" ]; then + echo " air not found — installing..." >&2 + go install github.com/air-verse/air@latest + AIR_BIN="$(go env GOPATH)/bin/air" +fi + +nohup "$AIR_BIN" -c /workspace/.air.toml > "$LOGDIR/api-dev.log" 2>&1 & echo $! > "$PIDDIR/api.pid" printf " %-12s building..." "api" for _ in $(seq 1 30); do @@ -90,7 +101,7 @@ done if is_port_open $PORT; then printf " ready (%s mode, hot-reload)\n" "$MODE" else - echo " waiting (check $LOGDIR/api-dev.log)" + echo " slow start (check $LOGDIR/api-dev.log)" fi # Ensure Vite is running.