Compute Engine

Make sure your Compute Engine VM instances are created with the access
scope option Allow full access to all Cloud APIs, or have one of the
following access scopes:

https://www.googleapis.com/auth/cloud-platform

https://www.googleapis.com/auth/cloud_debugger

The current Go compiler's optimizations interfere with accurate debugging.
As a result, Stackdriver Debugger shows incorrect information about your
application when your application is built with the default Go compiler
optimizations.

To get the correct debugging information, build your application without the
default optimizations. The following sample commands demonstrate how to
disable optimizations when using go1.10 or a later version:

go build -gcflags=all='-N -l'

The preceding gcflags value includes -N to disable optimizations and
-l to disable inlining.

Download the debugger agent.

The Stackdriver Debugger agent is a light-weight binary that you enable for
your application at startup. The agent starts with your application and
communicates with the Stackdriver Debugger backend while the application is
running.

Once you've built and deployed your Compute Engine application, download and
install the debug agent:

go get -u cloud.google.com/go/cmd/go-cloud-debug-agent

Warning:go-cloud-debug-agent must be compiled with the same or newer
version of Go as the binary you're debugging.