Skip to content

Commit c828812

Browse files
authored
feat(go): support go 1.27 and delve 1.27.2 (#150)
Delve 1.24.1 cannot read variables of Go 1.27 binaries (it supports up to Go 1.24). Adds the Go 1.27 integration test like the earlier version bumps.
1 parent 64a1c14 commit c828812

3 files changed

Lines changed: 100 additions & 2 deletions

File tree

‎go/helper-image/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
ARG GOVERSION=1.24
1+
ARG GOVERSION=1.27
22
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} AS delve
33
ARG BUILDPLATFORM
44
ARG TARGETOS
55
ARG TARGETARCH
66

7-
ARG DELVE_VERSION=1.24.1
7+
ARG DELVE_VERSION=1.27.2
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/skaffold.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ profiles:
9494
docker:
9595
buildArgs:
9696
GOVERSION: '1.24'
97+
- op: add
98+
path: /build/artifacts/-
99+
value:
100+
image: go127app
101+
context: test/goapp
102+
docker:
103+
buildArgs:
104+
GOVERSION: '1.27'
97105

98106
deploy:
99107
kubectl:
@@ -105,6 +113,7 @@ profiles:
105113
- test/k8s-test-go122.yaml
106114
- test/k8s-test-go123.yaml
107115
- test/k8s-test-go124.yaml
116+
- test/k8s-test-go127.yaml
108117

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

‎go/test/k8s-test-go127.yaml‎

Lines changed: 89 additions & 0 deletions
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: go127pod
6+
labels:
7+
app: hello
8+
protocol: dlv
9+
runtime: go127
10+
spec:
11+
containers:
12+
- name: go127app
13+
image: go127app
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-go127
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: go127
64+
65+
---
66+
apiVersion: batch/v1
67+
kind: Job
68+
metadata:
69+
name: connect-to-go127
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-go127
81+
image: kubectl
82+
command: [sh, -c, "while ! curl -s hello-dlv-go127:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
83+
containers:
84+
- name: dlv-to-go127
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-go127:56286']

0 commit comments

Comments
 (0)