Skip to content

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

Open

Description

@pfcouto

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

Activity

  1. changed the title [-]affected/package: db[/-] [+]x/tools/gopls: no action for TestMain[/+] on Mar 16, 2023
  2. added
    ToolsThis label describes issues relating to any tools in the x/tools repository.
    goplsIssues related to the Go language server, gopls.
    on Mar 16, 2023
  3. added this to the Unreleased milestone on Mar 16, 2023
  4. findleyr commented on Mar 24, 2023

    @findleyr
    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

  5. added
    FeatureRequestIssues asking for a new feature that does not need a proposal.
    on Mar 24, 2023
  6. pfcouto commented on Mar 24, 2023

    @pfcouto
    Author

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

  7. hyangah commented on Mar 24, 2023

    @hyangah
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions