-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for delve debugging in the shell
Signed-off-by: Laurent Goderre <[email protected]>
- Loading branch information
1 parent
c234dd9
commit 7829129
Showing
3 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if ! command -v $1 &> /dev/null; then | ||
echo >&2 'error: binary-daemon or dynbinary-daemon must be run before run' | ||
false | ||
fi | ||
|
||
COMMAND="$(command -v $1)" | ||
|
||
if [ -n "$DELVE_PORT" ]; then | ||
delve_listen_port="${DELVE_PORT##*:}" | ||
fi | ||
|
||
command=("$COMMAND") | ||
|
||
if [ -n "$DELVE_PORT" ]; then | ||
command=( | ||
dlv | ||
--listen="0.0.0.0:$delve_listen_port" | ||
--headless=true | ||
--log | ||
--api-version=2 | ||
--only-same-user=false | ||
--check-go-version=false | ||
--accept-multiclient | ||
exec "${command[@]}" -- | ||
) | ||
fi | ||
|
||
set -x | ||
# shellcheck disable=SC2086 | ||
exec "${command[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters