Skip to content

Commit ba2c7c1

Browse files
authored
Update to Delve 1.4.0 but change --only-same-user default to false (#38)
1 parent be1850e commit ba2c7c1

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

go/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
FROM golang:1.14.1 as delve
2-
RUN curl --location --output delve-1.3.1.tar.gz https://github.com/go-delve/delve/archive/v1.3.1.tar.gz \
3-
&& tar xzf delve-1.3.1.tar.gz
2+
3+
RUN curl --location --output delve-1.4.0.tar.gz https://github.com/go-delve/delve/archive/v1.4.0.tar.gz \
4+
&& tar xzf delve-1.4.0.tar.gz
5+
6+
# Patch delve to change default for --only-same-user to false
7+
# Required as `kubectl port-forward` to dlv port is refused.
8+
# We must install patch(1) to apply the patch.
9+
COPY delve-only-same-user.patch .
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
patch \
12+
&& patch -p0 < delve-only-same-user.patch
13+
414
# Produce an as-static-as-possible dlv binary to work on musl and glibc
5-
RUN cd delve-1.3.1 && CGO_ENABLED=0 go build -o /go/dlv -ldflags '-extldflags "-static"' ./cmd/dlv/
15+
RUN cd delve-1.4.0 && CGO_ENABLED=0 go build -o /go/dlv -ldflags '-extldflags "-static"' ./cmd/dlv/
616

717
# Now populate the duct-tape image with the language runtime debugging support files
818
# The debian image is about 95MB bigger

go/delve-only-same-user.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git delve-1.4.0/cmd/dlv/cmds/commands.go delve-1.4.0/cmd/dlv/cmds/commands.go
2+
index 0a17860..7e46206 100644
3+
--- delve-1.4.0/cmd/dlv/cmds/commands.go
4+
+++ delve-1.4.0/cmd/dlv/cmds/commands.go
5+
@@ -114,7 +114,7 @@ func New(docCall bool) *cobra.Command {
6+
RootCommand.PersistentFlags().StringVar(&BuildFlags, "build-flags", buildFlagsDefault, "Build flags, to be passed to the compiler.")
7+
RootCommand.PersistentFlags().StringVar(&WorkingDir, "wd", ".", "Working directory for running the program.")
8+
RootCommand.PersistentFlags().BoolVarP(&CheckGoVersion, "check-go-version", "", true, "Checks that the version of Go in use is compatible with Delve.")
9+
- RootCommand.PersistentFlags().BoolVarP(&CheckLocalConnUser, "only-same-user", "", true, "Only connections from the same user that started this instance of Delve are allowed to connect.")
10+
+ RootCommand.PersistentFlags().BoolVarP(&CheckLocalConnUser, "only-same-user", "", false, "Only connections from the same user that started this instance of Delve are allowed to connect.")
11+
RootCommand.PersistentFlags().StringVar(&Backend, "backend", "default", `Backend selection (see 'dlv help backend').`)
12+
13+
// 'attach' subcommand.

0 commit comments

Comments
 (0)