Closed Kuo-Chun-Ting closed 9 months ago
Thanks for the report.
@Kuo-Chun-Ting Can you please check if you can use dlv
command line tool and set the breakpoint?
$ /Users/lillard/go/bin/dlv debug .
(dlv) b main.go:7
(dlv) c
If it fails, I think this is a duplicate of https://github.com/go-delve/delve/issues/3519 and it requires reinstalling xcode. Can you try to reinstall xcode and see if that helps?
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
@hyangah Thank you for the quick response. The steps you provided worked. Thanks again.
Good to hear that that fixed the issue. Happy coding!
Closing.
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_. - go1.19 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - golang.org/x/tools/gopls v0.14.2 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - Version: 1.84.2 * Check your installed extensions to get the version of the VS Code Go extension - 0.40.0 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. ``` Checking configured tools.... GOBIN: undefined toolsGopath: gopath: /Users/lillard/go GOROOT: /Users/lillard/.gvm/gos/go1.19 PATH: /Users/lillard/.gvm/gos/go1.19/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Users/lillard/.gvm/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands PATH (vscode launched with): /Library/Frameworks/Python.framework/Versions/3.11/bin:/Users/lillard/.gvm/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands go: /Users/lillard/.gvm/gos/go1.19/bin/go: go version go1.19 darwin/amd64 gopls: /Users/lillard/go/bin/gopls (version: v0.14.2 built with go: go1.19) gotests: /Users/lillard/go/bin/gotests (version: v1.6.0 built with go: go1.19) gomodifytags: /Users/lillard/go/bin/gomodifytags (version: v1.16.0 built with go: go1.19) impl: /Users/lillard/go/bin/impl (version: v1.1.0 built with go: go1.19) goplay: /Users/lillard/go/bin/goplay (version: v1.0.0 built with go: go1.19) dlv: /Users/lillard/go/bin/dlv (version: v1.21.2 built with go: go1.21.4) staticcheck: /Users/lillard/go/bin/staticcheck (version: v0.4.6 built with go: go1.19) go env Workspace Folder (test_break_points): /Users/lillard/coding/golang/test_break_points GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/lillard/Library/Caches/go-build" GOENV="/Users/lillard/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/lillard/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/lillard/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/lillard/.gvm/gos/go1.19" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/lillard/.gvm/gos/go1.19/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.19" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/lillard/coding/golang/test_break_points/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/5t/60zp_j115mbcb05zt8w_7v700000gn/T/go-build931582716=/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 thego.
or["go"]
orgopls
prefixes.I don't set any variable in the workspace settings.json. Here's the User settings.json
Describe the bug
I can run code in debug mode but can't set the breakpoints.
I would expect the code will stop at my break point normally without any errors.
Steps to reproduce the behavior:
<your_module_name>
import "fmt"
func main() { a := 1 fmt.Println(a) }
{ // 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": "Launch Package", "type": "go", "request": "launch", "mode": "auto", "program": "${fileDirname}" } ] }