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

x/tools/gopls: no action for TestMain #59067

Open
pfcouto opened this issue Mar 16, 2023 · 3 comments
Open

x/tools/gopls: no action for TestMain #59067

pfcouto opened this issue Mar 16, 2023 · 3 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@pfcouto
Copy link

pfcouto commented Mar 16, 2023

What version of Go are you using (go version)?

go version go1.19.6 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pedro/.cache/go-build"
GOENV="/home/pedro/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/pedro/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/pedro/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.6"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/pedro/Documents/Escola/Mestrado/2semestre/CC/projeto_individual/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3618416135=/tmp/go-build -gno-record-gcc-switches"

What did you do?

In VSCode when I try to create a TestMain function with the *testing.M nothing appears on top of it to run the test, as shown in the first picture. However, if I change it to something else, like T or even nothing it appears. I don't believe that it is my problem.

image

image

What did you expect to see?

A "run test" clickable text on top of the function

What did you see instead?

The "run test" clickable test does not appear

@seankhliao seankhliao changed the title affected/package: db x/tools/gopls: no action for TestMain Mar 16, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 16, 2023
@gopherbot gopherbot added this to the Unreleased milestone Mar 16, 2023
@findleyr
Copy link
Contributor

We can definitely produce code lenses here, though I think VS Code would also need an update to their middleware to actually invoke the test.

CC @hyangah

@pfcouto
Copy link
Author

pfcouto commented Mar 24, 2023

If you need anything else from me, just @ me and I will be at your disposal. Thanks for the help!

@hyangah
Copy link
Contributor

hyangah commented Mar 24, 2023

Related: golang/vscode-go#482

VS Code does not use gopls's test code lenses. The intention was not to present a code lens on TestMain(*testing.M) and obviously it didn't take into account the case where it's actively edited. (another related: golang/vscode-go#2435)

For package-level testing, there is "run package tests" codelens.

@findleyr findleyr modified the milestones: Unreleased, gopls/unplanned Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants