From f3cfb82e3cce51c9a637ec5de8cbaa3376ce73ad Mon Sep 17 00:00:00 2001 From: Etan Shaul Date: Tue, 31 Mar 2020 18:08:16 -0400 Subject: [PATCH 1/3] Add environment variable to better support skaffold debug `skaffold debug` uses heuristics to determine if an application can be debugged, as described here: https://skaffold.dev/docs/workflows/debug/ In it's current state, the application doesn't work with `skaffold debug` without one of the standard go-runtime env vars as explained in the docs. --- golang/go-cloud-run-hello-world/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/golang/go-cloud-run-hello-world/Dockerfile b/golang/go-cloud-run-hello-world/Dockerfile index d2d11cbb1..af17fb510 100644 --- a/golang/go-cloud-run-hello-world/Dockerfile +++ b/golang/go-cloud-run-hello-world/Dockerfile @@ -20,6 +20,9 @@ RUN go build -mod=readonly -v -o /app COPY index.html /index.html COPY assets ./assets/ +# Add stack traces for all user-created goroutines +ENV GOTRACEBACK=all + # If you want to use the debugger, you need to modify the entrypoint to the # container and point it to the "dlv debug" command: # * UNCOMMENT the following ENTRYPOINT statement, From e30d59248dac19eab59226bfaaf2ac741bd0e47d Mon Sep 17 00:00:00 2001 From: Etan Shaul Date: Wed, 1 Apr 2020 13:03:42 -0400 Subject: [PATCH 2/3] update to use default behavior --- golang/go-cloud-run-hello-world/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/golang/go-cloud-run-hello-world/Dockerfile b/golang/go-cloud-run-hello-world/Dockerfile index af17fb510..dac907b46 100644 --- a/golang/go-cloud-run-hello-world/Dockerfile +++ b/golang/go-cloud-run-hello-world/Dockerfile @@ -20,8 +20,8 @@ RUN go build -mod=readonly -v -o /app COPY index.html /index.html COPY assets ./assets/ -# Add stack traces for all user-created goroutines -ENV GOTRACEBACK=all +# Default behavior - a failure prints a stack trace for the current goroutine +ENV GOTRACEBACK=single # If you want to use the debugger, you need to modify the entrypoint to the # container and point it to the "dlv debug" command: From 8296a1f6e49536e93731cc24d0e978700195f65c Mon Sep 17 00:00:00 2001 From: Etan Shaul Date: Tue, 21 Apr 2020 15:08:52 -0700 Subject: [PATCH 3/3] Update golang/go-cloud-run-hello-world/Dockerfile Co-Authored-By: Adam Ross --- golang/go-cloud-run-hello-world/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/golang/go-cloud-run-hello-world/Dockerfile b/golang/go-cloud-run-hello-world/Dockerfile index dac907b46..c161c76e2 100644 --- a/golang/go-cloud-run-hello-world/Dockerfile +++ b/golang/go-cloud-run-hello-world/Dockerfile @@ -20,7 +20,9 @@ RUN go build -mod=readonly -v -o /app COPY index.html /index.html COPY assets ./assets/ -# Default behavior - a failure prints a stack trace for the current goroutine +# Definition of this variable is used by 'skaffold debug' to identify a golang binary. +# Default behavior - a failure prints a stack trace for the current goroutine. +# See https://golang.org/pkg/runtime/ ENV GOTRACEBACK=single # If you want to use the debugger, you need to modify the entrypoint to the