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: not understanding package_test #32906

Closed
jadekler opened this issue Jul 2, 2019 · 10 comments
Closed

x/tools/gopls: not understanding package_test #32906

jadekler opened this issue Jul 2, 2019 · 10 comments
Labels
Milestone

Comments

@jadekler
Copy link
Contributor

@jadekler jadekler commented Jul 2, 2019

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

$ go version
go version go1.12.5 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="/usr/local/google/home/deklerk/dev/go1.12.5.linux-amd64/go/bin"
GOCACHE="/usr/local/google/home/deklerk/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/deklerk/workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/google/home/deklerk/dev/go1.12.5.linux-amd64/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/deklerk/dev/go1.12.5.linux-amd64/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/usr/local/google/home/deklerk/workspace/google-cloud-go/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build430311602=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Using vscode with Go@0.11.0 plugin. Have package bigtable, create a new file conformance_test.go with package bigtable_test declaration.

What did you expect to see?

No problems in editor.

What did you see instead?

Red squiggly under package with text:

package bigtable_test; expected bigtable LSP
@gopherbot gopherbot added the gopls label Jul 2, 2019
@jadekler

This comment has been minimized.

Copy link
Contributor Author

@jadekler jadekler commented Jul 2, 2019

FYI, this is doubly annoying because it prevents any other interpretation of the file. So, unless I rename this package bigtable, there is no LSP on the entire file, rendering my editor mostly-useless.

@stamblerre stamblerre changed the title lsp: not understanding package_test x/tools/gopls: not understanding package_test Jul 2, 2019
@gopherbot gopherbot added this to the Unreleased milestone Jul 2, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Jul 2, 2019

What version of gopls are you using (gopls version)? What happens when you save the file - does the error ever go away?

@jadekler

This comment has been minimized.

Copy link
Contributor Author

@jadekler jadekler commented Jul 2, 2019

Not sure:

$ gopls version
no module information, gopls not built in module mode

So, I blew that binary away, reset everything I could in vscode, and performed:

go get golang.org/x/tools/gopls@latest

Now it seems to accept bigtable_test. Huzzah!

@jadekler jadekler closed this Jul 2, 2019
@jadekler

This comment has been minimized.

Copy link
Contributor Author

@jadekler jadekler commented Jul 2, 2019

Whoops, spoke too soon. Now I get an error at the first character of the file with the following:

file:///usr/local/google/home/deklerk/workspace/google-cloud-go/bigtable/conformance_test.go is not part of a package LSP

edit: Once again, changing package bigtable_test to package bigtable fixes this.

edit2:

$ gopls version
golang.org/x/tools/gopls v0.1.0
    golang.org/x/tools/gopls@v0.1.1 h1:mU/O8r53RjzdZfkqmFOX4iEt8PJxTPXyLdiuQNa27OE=

@jadekler jadekler reopened this Jul 2, 2019
@ogimenezb

This comment has been minimized.

Copy link

@ogimenezb ogimenezb commented Jul 5, 2019

Same problem here with VSCode

$ gopls version
golang.org/x/tools/gopls v0.1.0
    golang.org/x/tools/gopls@v0.1.1 h1:mU/O8r53RjzdZfkqmFOX4iEt8PJxTPXyLdiuQNa27OE=
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Jul 8, 2019

Can you try reproducing this on master (go get -u golang.org/x/tools/gopls@master)? We will likely be tagging a new version of gopls soon, but for now, the fix may already be on master.

@ogimenezb

This comment has been minimized.

Copy link

@ogimenezb ogimenezb commented Jul 9, 2019

Hi,

Still the same problem.

/const.go is not part of a package LSP

$ gopls version
golang.org/x/tools/gopls v0.1.1
    golang.org/x/tools/gopls@v0.1.2-0.20190708203411-c8855242db9c h1:qFHl9H1pFOvam5c7rRNiSVPuASu5sS/VNZUj7KNAyGI=
@ogimenezb

This comment has been minimized.

Copy link

@ogimenezb ogimenezb commented Jul 9, 2019

I have been doing some more testing.

If I have a package and have, for example

argon.go -> package passwords
argon_test.go -> package passwords_test

Work well, but If I have the same and is using cgo, Then I have the problem
As an example I add:

package passwords

/*

#cgo CFLAGS: -std=gnu99
*/
import "C"

argon.go is not part of a package LSP

Sorry didn't realize sooner, working on a cgo project for the last couple of weeks

@jadekler

This comment has been minimized.

Copy link
Contributor Author

@jadekler jadekler commented Jul 9, 2019

Seems to work on master for me.

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Jul 9, 2019

@ogimenezb: Your issue sounds more like #31561.
I will close this issue in favor of that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.