Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A problem about debug, can't watch a expression call str.String() the str is a var :strings.Builder. #2522

Closed
OrdinaryYZH opened this issue Nov 1, 2022 · 1 comment
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Milestone

Comments

@OrdinaryYZH
Copy link

OrdinaryYZH commented Nov 1, 2022

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.2 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • Build info

golang.org/x/tools/gopls v0.10.0
golang.org/x/tools/gopls@v0.10.0 h1:OGrMgGUl9LWTPaeN5ML3SotSguhrdMHbWevtM8cYN6s=
github.com/BurntSushi/toml@v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
github.com/google/go-cmp@v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/exp@v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp/typeparams@v0.0.0-20220722155223-a9213eeb770e h1:7Xs2YCOpMlNqSQSmrrnhlzBXIE/bpMecZplbLePTJvE=
golang.org/x/mod@v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/sync@v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
golang.org/x/sys@v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/text@v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/tools@v0.2.1-0.20221028182455-bd7d62852469 h1:N4UYjGjl5FFK3cn1CiPnWdTiLe3SjfprMLDNiYh+0Fc=
golang.org/x/vuln@v0.0.0-20221010193109-563322be2ea9 h1:KaYZQUtEEaV8aVADIHAuYBTjo77aUcCvC7KTGKM3J1I=
honnef.co/go/tools@v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA=
mvdan.cc/gofumpt@v0.3.1 h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8=
mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.19.2

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

    • 1.72.2
      d045a5eda657f4d7b676dedbfa7aab8207f8a075
      x64
  • Check your installed extensions to get the version of the VS Code Go extension

    • 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: F:\Code\go
      GOROOT: C:\Program Files\Go
      PATH: C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\Java\jdk1.8.0_181\jre\bin;C:\CTEX\UserData\miktex\bin;C:\CTEX\MiKTeX\miktex\bin;C:\CTEX\CTeX\ctex\bin;C:\CTEX\CTeX\cct\bin;C:\CTEX\CTeX\ty\bin;C:\CTEX\Ghostscript\gs9.05\bin;C:\CTEX\GSview\gsview;C:\CTEX\WinEdt;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\nodejs;C:\Program Files\nodejs;E:\software\ffmpeg-4.2.2-win64-static\bin;C:\Program Files\Microsoft VS Code\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\PowerShell\7;C:\Program Files\Go\bin;C:\Ruby23-x64\bin;C:\Users\yao\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\yao\AppData\Roaming\npm;C:\Program Files\nodejs;C:\Users\yao\go\bin

    go: C:\Program Files\Go\bin\go.exe: go version go1.19.2 windows/amd64

    gotests: F:\Code\go\bin\gotests.exe (version: v1.6.0 built with go: go1.19.2)
    gomodifytags: F:\Code\go\bin\gomodifytags.exe (version: v1.16.0 built with go: go1.19.2)
    impl: F:\Code\go\bin\impl.exe (version: v1.1.0 built with go: go1.19.2)
    goplay: F:\Code\go\bin\goplay.exe (version: v1.0.0 built with go: go1.19.2)
    dlv: F:\Code\go\bin\dlv.exe (version: v1.9.1 built with go: go1.19.2)
    staticcheck: F:\Code\go\bin\staticcheck.exe (version: v0.3.3 built with go: go1.19.2)
    gopls: F:\Code\go\bin\gopls.exe (version: v0.10.0 built with go: go1.19.2)

go env
Workspace Folder (src): f:\Code\go\src
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\yao\AppData\Local\go-build
set GOENV=C:\Users\yao\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=F:\Code\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=F:\Code\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\yao\AppData\Local\Temp\go-build464609539=/tmp/go-build -gno-record-gcc-switches

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

I want to check a expression in my program, the expression is call str.String(), the str is a var :strings.Builder.

It tips me "Unable to evaluate expression: cannot use str.String as argument b in function strings.(*Builder).String: stack object passed to escaping pointer: b"

The detail pls look at the screenshot

I asked somebody, they said it is ok in Goland, so I don't konw is it a bug or not surpport in vscode

Steps to reproduce the behavior:

Screenshots or recordings

image

@gopherbot gopherbot added this to the Untriaged milestone Nov 1, 2022
@findleyr findleyr added the Debug Issues related to the debugging functionality of the extension. label Nov 1, 2022
@findleyr
Copy link
Member

findleyr commented Nov 1, 2022

It looks like this is a known limitation of calling functions in watch expressions: golang/go#21678 (comment)

Closing as this is a known limitation of the runtime, and is out of scope for the vscode-go project. As a workaround, you can (of course) assign str.String() to a variable. Sorry.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants