Break points not working debbuing golang in VScode

Viewed 2692

I have a problem when debugging a project which is done in golang, the project compiles correctly and runs perfectly, however when I add a break point, the console returns the following error. I am not using rosetta.

I also managed to reproduce the same problem with GoLand (IDE JetBrains)

enter image description here

If I remove the break point and continue with the process, the project continues to run without errors. The problem is when VScode finds the break point.

Im using macOS Big Sur version 11.3 (20E232)

What version of Go im using (go version)?


    $ go version go1.16.3 darwin/arm64

What operating system and processor architecture im using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/thomascaycedomartinez/Library/Caches/go-build"
GOENV="/Users/thomascaycedomartinez/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/thomascaycedomartinez/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/thomascaycedomartinez/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2x/7xq8cphj5gzc5lq2fbbl3vtw0000gn/T/go-build3536386239=/tmp/go-build -gno-record-gcc-switches -fno-common"

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "kuenta backend",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/cmd/kuenta",
            "env": {
                "HOSTNAME": "localhost"
            },
            "args": []
        }
    ]
}

What did you expect to see?

The break points should work, correctly.

1 Answers

Well, in short, this is an issue that apparently occurs with the latest update in macOS Big Sur 11.3 (20E232)

To partially solve this problem until fixed.

  • You need to clone the dlv repository and add the following code block1

  • Rebuild and copy dlv to temp path.

  • Go to goland and select Edit Custom Propierties 1

  • Add the path to delve on a new line in my case dlv.path=/Users/thomascaycedomartinez/go/bin/dlv 4

  • Save the file and now you can debug normaly.

  • To see more information you can visit this issue https://github.com/go-delve/delve/issues/2436

Related