Skip to content

Commit 7a339dc

Browse files
feat(go): support go 1.23 and delve 1.23.1 (#140)
1 parent 4d5799b commit 7a339dc

8 files changed

+89
-242
lines changed

go/helper-image/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
ARG GOVERSION=1.20
2-
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} as delve
1+
ARG GOVERSION=1.23
2+
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} AS delve
33
ARG BUILDPLATFORM
44
ARG TARGETOS
55
ARG TARGETARCH
66

7-
ARG DELVE_VERSION=1.20.1
7+
ARG DELVE_VERSION=1.23.1
88

99
# Patch delve to make defaults for --check-go-version and --only-same-user
1010
# to be set at build time. We must install patch(1) to apply the patch.

go/helper-image/delve-as-options.patch

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
diff --git cmd/dlv/cmds/commands.go cmd/dlv/cmds/commands.go
2-
index 15df5f6..f145330 100644
2+
index b5b7662c..dcdae257 100644
33
--- cmd/dlv/cmds/commands.go
44
+++ cmd/dlv/cmds/commands.go
5-
@@ -46,6 +46,10 @@ var (
6-
apiVersion int
7-
// acceptMulti allows multiple clients to connect to the same server
8-
acceptMulti bool
9-
+ // checkGoVersionDefault sets default for --check-go-version
10-
+ checkGoVersionDefault = "true"
5+
@@ -61,6 +61,8 @@ var (
6+
// checkLocalConnUser is true if the debugger should check that local
7+
// connections come from the same user that started the headless server
8+
checkLocalConnUser bool
119
+ // checkLocalConnUserDefault sets default for --only-same-user
1210
+ checkLocalConnUserDefault = "true"
13-
// addr is the debugging server listen address.
14-
addr string
15-
// initFile is the path to initialization file.
16-
@@ -139,8 +143,8 @@ func New(docCall bool) *cobra.Command {
17-
rootCommand.PersistentFlags().StringVar(&initFile, "init", "", "Init file, executed by the terminal client.")
18-
rootCommand.PersistentFlags().StringVar(&buildFlags, "build-flags", buildFlagsDefault, "Build flags, to be passed to the compiler. For example: --build-flags=\"-tags=integration -mod=vendor -cover -v\"")
11+
// tty is used to provide an alternate TTY for the program you wish to debug.
12+
tty string
13+
// disableASLR is used to disable ASLR
14+
@@ -78,6 +80,8 @@ var (
15+
// used to compile the executable and refuse to work on incompatible
16+
// versions.
17+
checkGoVersion bool
18+
+ // checkGoVersionDefault sets default for --check-go-version
19+
+ checkGoVersionDefault = "true"
20+
21+
// rootCommand is the root of the command tree.
22+
rootCommand *cobra.Command
23+
@@ -158,8 +162,8 @@ func New(docCall bool) *cobra.Command {
24+
must(rootCommand.RegisterFlagCompletionFunc("build-flags", cobra.NoFileCompletions))
1925
rootCommand.PersistentFlags().StringVar(&workingDir, "wd", "", "Working directory for running the program.")
26+
must(rootCommand.MarkPersistentFlagDirname("wd"))
2027
- rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", true, "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.")
2128
- rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", true, "Only connections from the same user that started this instance of Delve are allowed to connect.")
2229
+ rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", parseBool(checkGoVersionDefault), "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.")
2330
+ rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", parseBool(checkLocalConnUserDefault), "Only connections from the same user that started this instance of Delve are allowed to connect.")
2431
rootCommand.PersistentFlags().StringVar(&backend, "backend", "default", `Backend selection (see 'dlv help backend').`)
32+
must(rootCommand.RegisterFlagCompletionFunc("backend", cobra.FixedCompletions([]string{"default", "native", "lldb", "rr"}, cobra.ShellCompDirectiveNoFileComp)))
2533
rootCommand.PersistentFlags().StringArrayVarP(&redirects, "redirect", "r", []string{}, "Specifies redirect rules for target process (see 'dlv help redirect')")
26-
rootCommand.PersistentFlags().BoolVar(&allowNonTerminalInteractive, "allow-non-terminal-interactive", false, "Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr")
27-
@@ -1020,3 +1024,14 @@ func parseRedirects(redirects []string) ([3]string, error) {
34+
@@ -1250,3 +1254,14 @@ func must(err error) {
35+
log.Fatal(err)
2836
}
29-
return r, nil
3037
}
3138
+
3239
+// parseBool parses a boolean value represented by a string, and panics if there is an error.

go/skaffold.yaml

+30-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ profiles:
4545
context: test/goapp
4646
docker:
4747
buildArgs:
48-
GOVERSION: 1.18
48+
GOVERSION: '1.18'
4949
- op: add
5050
path: /build/artifacts/-
5151
value:
5252
image: go119app
5353
context: test/goapp
5454
docker:
5555
buildArgs:
56-
GOVERSION: 1.19
56+
GOVERSION: '1.19'
5757
- op: add
5858
path: /build/artifacts/-
5959
value:
@@ -62,12 +62,40 @@ profiles:
6262
docker:
6363
buildArgs:
6464
GOVERSION: '1.20'
65+
- op: add
66+
path: /build/artifacts/-
67+
value:
68+
image: go121app
69+
context: test/goapp
70+
docker:
71+
buildArgs:
72+
GOVERSION: '1.21'
73+
- op: add
74+
path: /build/artifacts/-
75+
value:
76+
image: go122app
77+
context: test/goapp
78+
docker:
79+
buildArgs:
80+
GOVERSION: '1.22'
81+
- op: add
82+
path: /build/artifacts/-
83+
value:
84+
image: go123app
85+
context: test/goapp
86+
docker:
87+
buildArgs:
88+
GOVERSION: '1.23'
89+
6590
deploy:
6691
kubectl:
6792
manifests:
6893
- test/k8s-test-go118.yaml
6994
- test/k8s-test-go119.yaml
7095
- test/k8s-test-go120.yaml
96+
- test/k8s-test-go121.yaml
97+
- test/k8s-test-go122.yaml
98+
- test/k8s-test-go123.yaml
7199

72100
# release: pushes images to production with :latest
73101
- name: release

go/test/k8s-test-go116.yaml

-91
This file was deleted.

go/test/k8s-test-go117.yaml

-91
This file was deleted.

go/test/k8s-test-go113.yaml go/test/k8s-test-go121.yaml

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
apiVersion: v1
33
kind: Pod
44
metadata:
5-
name: go113pod
5+
name: go121pod
66
labels:
77
app: hello
88
protocol: dlv
9-
runtime: go113
9+
runtime: go121
1010
spec:
1111
containers:
12-
- name: go113app
13-
image: go113app
12+
- name: go121app
13+
image: go121app
1414
args:
1515
- /dbg/go/bin/dlv
1616
- exec
@@ -48,7 +48,7 @@ spec:
4848
apiVersion: v1
4949
kind: Service
5050
metadata:
51-
name: hello-dlv-go113
51+
name: hello-dlv-go121
5252
spec:
5353
ports:
5454
- name: http
@@ -60,13 +60,13 @@ spec:
6060
selector:
6161
app: hello
6262
protocol: dlv
63-
runtime: go113
63+
runtime: go121
6464

6565
---
6666
apiVersion: batch/v1
6767
kind: Job
6868
metadata:
69-
name: connect-to-go113
69+
name: connect-to-go121
7070
labels:
7171
project: container-debug-support
7272
type: integration-test
@@ -77,15 +77,13 @@ spec:
7777
spec:
7878
restartPolicy: Never
7979
initContainers:
80-
- name: wait-for-go113pod
80+
- name: wait-for-go121
8181
image: kubectl
82-
command: [sh, -c, "while ! curl -s hello-dlv-go113:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
82+
command: [sh, -c, "while ! curl -s hello-dlv-go121:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
8383
containers:
84-
- name: dlv-to-go113
84+
- name: dlv-to-go121
8585
image: skaffold-debug-go
8686
command: [sh, -c, '
8787
(echo bt; echo exit -c) > init.txt;
8888
set -x;
89-
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go113:56286']
90-
91-
89+
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go121:56286']

0 commit comments

Comments
 (0)