Skip to content

VSCode Breakpoint not hitting/stopping when run in debugger mode - Golang #2417

@riderrocks

Description

@riderrocks

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    go version go1.19 darwin/amd64

  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    Unknown command: gopls

  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    1.70.2
    e4503b30fc78200f846c62cf8091b76ff5547662
    x64

  • Check your installed extensions to get the version of the VS Code Go extension
    Go v0.35.2

  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    Checking configured tools....
    GOBIN: undefined
    toolsGopath:
    gopath: /Users/ananthraghav/go
    GOROOT: /usr/local/go
    PATH: /Users/ananthraghav/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mongodb/bin/:/usr/local/go/bin

    go: /usr/local/go/bin/go: go version go1.19 darwin/amd64

    gotests: /Users/ananthraghav/go/bin/gotests (version: v1.6.0 built with go: go1.19)
    gomodifytags: /Users/ananthraghav/go/bin/gomodifytags (version: v1.16.0 built with go: go1.19)
    impl: /Users/ananthraghav/go/bin/impl (version: v1.1.0 built with go: go1.19)
    goplay: /Users/ananthraghav/go/bin/goplay (version: v1.0.0 built with go: go1.19)
    dlv: /Users/ananthraghav/go/bin/dlv (version: v1.9.0 built with go: go1.19)
    staticcheck: /Users/ananthraghav/go/bin/staticcheck (version: v0.3.3 built with go: go1.19)
    gopls: /Users/ananthraghav/go/bin/gopls (version: v0.9.4 built with go: go1.19)

go env
Workspace Folder (le-diy): /Users/ananthraghav/go/src/stash.bms.bz/bms/le-diy
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ananthraghav/Library/Caches/go-build"
GOENV="/Users/ananthraghav/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-trimpath"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ananthraghav/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ananthraghav/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ananthraghav/go/src/stash.bms.bz/bms/le-diy/go.mod"
GOWORK=""
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ym/b8142c6d0hlc3byfnh5bggmr0000gq/T/go-build37387940=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

When Start Debugging is fired, the program runs successfully. However the program doesn't stop at breakpoints.
Breakpoint is enabled and placed alright. But it doesn't hit

Steps to reproduce the behavior:

  1. Go to Run -> Start debugging
  2. See in debug console - DAP server listening at: 127.0.0.1:50757
  3. Process 31415 has exited with status 0
    dlv dap (31383) exited with code: 0

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

Screenshot 2022-08-18 at 9 54 05 PM

defaultSettings.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions