Skip to content

Commit 32da851

Browse files
authored
feat(go): support Go 1.20 and Delve 1.20.1 (#126)
* Update to delve 1.20 and go1.20. * Add tests for go120. * Add quotes to avoid truncating trailing 0.
1 parent 56a4d5b commit 32da851

File tree

3 files changed

+101
-3
lines changed

3 files changed

+101
-3
lines changed

Diff for: go/helper-image/Dockerfile

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

7-
ARG DELVE_VERSION=1.9.1
7+
ARG DELVE_VERSION=1.20.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.
1111
#
1212
# We default --check-go-version to false to support binaries compiled
1313
# with unsupported versions of Go. Delve issues a prominent warning.
14-
#
14+
#
1515
# We default --only-same-user to false as `kubectl port-forward`
1616
# to dlv port is refused otherwise.
1717
RUN apt-get update && apt-get install -y --no-install-recommends \

Diff for: go/skaffold.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ profiles:
9494
docker:
9595
buildArgs:
9696
GOVERSION: 1.19
97+
- op: add
98+
path: /build/artifacts/-
99+
value:
100+
image: go120app
101+
context: test/goapp
102+
docker:
103+
buildArgs:
104+
GOVERSION: '1.20'
97105
deploy:
98106
kubectl:
99107
manifests:
@@ -104,6 +112,7 @@ profiles:
104112
- test/k8s-test-go117.yaml
105113
- test/k8s-test-go118.yaml
106114
- test/k8s-test-go119.yaml
115+
- test/k8s-test-go120.yaml
107116

108117
# release: pushes images to production with :latest
109118
- name: release

Diff for: go/test/k8s-test-go120.yaml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This test approximates `skaffold debug` for a go app.
2+
apiVersion: v1
3+
kind: Pod
4+
metadata:
5+
name: go120pod
6+
labels:
7+
app: hello
8+
protocol: dlv
9+
runtime: go120
10+
spec:
11+
containers:
12+
- name: go120app
13+
image: go120app
14+
args:
15+
- /dbg/go/bin/dlv
16+
- exec
17+
- --log
18+
- --headless
19+
- --continue
20+
- --accept-multiclient
21+
# listen on 0.0.0.0 as it is exposed as a service
22+
- --listen=0.0.0.0:56286
23+
- --api-version=2
24+
- ./app
25+
ports:
26+
- containerPort: 8080
27+
- containerPort: 56286
28+
name: dlv
29+
readinessProbe:
30+
httpGet:
31+
path: /
32+
port: 8080
33+
volumeMounts:
34+
- mountPath: /dbg
35+
name: go-debugging-support
36+
initContainers:
37+
- image: skaffold-debug-go
38+
name: install-go-support
39+
resources: {}
40+
volumeMounts:
41+
- mountPath: /dbg
42+
name: go-debugging-support
43+
volumes:
44+
- emptyDir: {}
45+
name: go-debugging-support
46+
47+
---
48+
apiVersion: v1
49+
kind: Service
50+
metadata:
51+
name: hello-dlv-go120
52+
spec:
53+
ports:
54+
- name: http
55+
port: 8080
56+
protocol: TCP
57+
- name: dlv
58+
port: 56286
59+
protocol: TCP
60+
selector:
61+
app: hello
62+
protocol: dlv
63+
runtime: go120
64+
65+
---
66+
apiVersion: batch/v1
67+
kind: Job
68+
metadata:
69+
name: connect-to-go120
70+
labels:
71+
project: container-debug-support
72+
type: integration-test
73+
spec:
74+
ttlSecondsAfterFinished: 10
75+
backoffLimit: 1
76+
template:
77+
spec:
78+
restartPolicy: Never
79+
initContainers:
80+
- name: wait-for-go120
81+
image: kubectl
82+
command: [sh, -c, "while ! curl -s hello-dlv-go120:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
83+
containers:
84+
- name: dlv-to-go120
85+
image: skaffold-debug-go
86+
command: [sh, -c, '
87+
(echo bt; echo exit -c) > init.txt;
88+
set -x;
89+
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go120:56286']

0 commit comments

Comments
 (0)