From 1435eec515e700d0853c61dc05ac3c9ad3d6c8a8 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Tue, 14 Apr 2020 15:34:11 -0400 Subject: [PATCH] Update VS Code Go launch snippet VS Code now warns on unnecessary properties like "program". And note the "cwd" property for the local location. --- docs/content/en/docs/workflows/debug.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/content/en/docs/workflows/debug.md b/docs/content/en/docs/workflows/debug.md index f14ecdf43ac..0bcc45ef533 100644 --- a/docs/content/en/docs/workflows/debug.md +++ b/docs/content/en/docs/workflows/debug.md @@ -49,9 +49,12 @@ Go-based applications are configured to run under [Delve](https://github.com/go- The [Distroless project](https://github.com/GoogleContainerTools/distroless)'s `gcr.io/distroless/base` is a minimal Debian/glibc-based image that works well as a base image. -Note for users of [VS Code's debug adapter for Go](https://github.com/Microsoft/vscode-go): -the source location must be set to the remote source location _during compilation_. For example, the -`golang` images, which are [often used in multi-stage builds](https://github.com/GoogleContainerTools/skaffold/tree/master/examples/getting-started/Dockerfile), +Note for users of [VS Code's debug adapter for Go](https://github.com/Microsoft/vscode-go): the debug adapter +may require configuring both the _local_ and _remote_ source path prefixes via the `cwd` and `remotePath` properties. +The `cwd` property should point to the top-level container of your source files and should generally match +the artifact's `context` directory in the `skaffold.yaml`. The `remotePath` path property should be set to the +remote source location _during compilation_. For example, the `golang` images, which are +[often used in multi-stage builds](https://github.com/GoogleContainerTools/skaffold/tree/master/examples/getting-started/Dockerfile), copy the source code to `/go`. The following [remote launch configuration](https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code#remote-debugging) works in this case: @@ -63,8 +66,8 @@ works in this case: "mode": "remote", "host": "localhost", "port": 56268, - "remotePath": "/go/", - "program": "/Users/login/go/src/github.com/GoogleContainerTools/skaffold/integration/testdata/debug/go/", + "cwd": "${workspaceFolder}", + "remotePath": "/go/" } ```