mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
feat(scripts/develop.sh): add --debug flag to develop.sh (#12423)
Adds a `--debug` flag to `scripts/develop.sh` that will start coder under `dlv debug` instead. You can then use e.g. the following launch snippet to connect dlv: ``` { "name": "Delve Remote", "type": "go", "request": "attach", "mode": "remote", "port": 12345, } ``` You can also run invididual CLI commands under dlv e.g. ``` debug=1 scripts/coder-dev.sh list ``` Also sets CGO_ENABLED=0 in develop.sh by default.
This commit is contained in:
@ -10,6 +10,7 @@ source "${SCRIPT_DIR}/lib.sh"
|
||||
|
||||
GOOS="$(go env GOOS)"
|
||||
GOARCH="$(go env GOARCH)"
|
||||
DEBUG_DELVE="${DEBUG_DELVE:-0}"
|
||||
BINARY_TYPE=coder-slim
|
||||
if [[ ${1:-} == server ]]; then
|
||||
BINARY_TYPE=coder
|
||||
@ -55,4 +56,10 @@ coder)
|
||||
;;
|
||||
esac
|
||||
|
||||
exec "${CODER_DEV_BIN}" --global-config "${CODER_DEV_DIR}" "$@"
|
||||
runcmd=("${CODER_DEV_BIN}")
|
||||
if [[ "${DEBUG_DELVE}" == 1 ]]; then
|
||||
set -x
|
||||
runcmd=(dlv debug --headless --continue --listen 127.0.0.1:12345 --accept-multiclient ./cmd/coder --)
|
||||
fi
|
||||
|
||||
CGO_ENABLED=0 exec "${runcmd[@]}" --global-config "${CODER_DEV_DIR}" "$@"
|
||||
|
Reference in New Issue
Block a user