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: "Your workspace is misconfigured" after creating new file #37958

Closed
atombender opened this issue Mar 20, 2020 · 5 comments
Closed

x/tools/gopls: "Your workspace is misconfigured" after creating new file #37958

atombender opened this issue Mar 20, 2020 · 5 comments
Labels
Milestone

Comments

@atombender
Copy link

@atombender atombender commented Mar 20, 2020

What did you do?

In VSCode, I created a new, empty file (count.go) in a package, with a package declaration at the top.

What did you expect to see?

No errors.

What did you see instead?

This VSCode error:

Your workspace is misconfigured: github.com/sanity-io/gradient/pkg/search/elasticsearch/querysource_test [github.com/sanity-io/gradient/pkg/search/elasticsearch/querysource.test] has no metadata. Please see https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md for more information or file an issue (https://github.com/golang/go/issues/new) if you believe this is a mistake.

There is no folder called querysource_test or querysource.test, either. I was working in the package github.com/sanity-io/gradient/pkg/search/elasticsearch/querysource.

Not able to reproduce.

Log

gopls.log.gz

Build info

golang.org/x/tools/gopls v0.3.4
    golang.org/x/tools/gopls@(devel)
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200316194252-fafb6e2e8a4a => ../
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.14 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/alex/Library/Caches/go-build"
GOENV="/Users/alex/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="github.com/t11e/*"
GONOSUMDB="github.com/t11e/*"
GOOS="darwin"
GOPATH="/Users/alex/.go"
GOPRIVATE="github.com/t11e/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/alex/Projects/Sanity/gradient/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=/var/folders/qs/wpmg19r12_9_nz7pvvs2_82r0000gn/T/go-build106968531=/tmp/go-build -gno-record-gcc-switches -fno-common"
@gopherbot gopherbot added this to the Unreleased milestone Mar 20, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 20, 2020

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 20, 2020
@polly3d
Copy link

@polly3d polly3d commented Mar 20, 2020

I have the same issue.
It happened when I create a new file and named(or renamed) package as **_test.
Like this:

package something_test

I have to restart the language server every time.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Mar 20, 2020

Thanks for the report! This is being investigated as part of the discussion on #36960, but I'll use this issue to track the fix.

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 20, 2020

Change https://golang.org/cl/224538 mentions this issue: internal/lsp: be more careful about showing workspace misconfig message

@leitzler
Copy link
Contributor

@leitzler leitzler commented Mar 20, 2020

As per Slack discussion with @stamblerre - the message appears when removing sub modules in the current workspace as well.
Repro using govim:

$ cd $(mktemp -d) && go mod init x
go: creating new go.mod: module x
/tmp/tmp.i5Qph4SRHl$ cat > x.go <<EOF
> package x
> EOF
/tmp/tmp.i5Qph4SRHl$ vi x.go

then in another terminal:

/tmp/tmp.i5Qph4SRHl/foo$ cat > foo.go <<EOF
> package main
> EOF
/tmp/tmp.i5Qph4SRHl/foo$ cd ..
/tmp/tmp.i5Qph4SRHl$ rm -rf foo

"Workspace is misconfigured" message shows up, see gopls log

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
5 participants
You can’t perform that action at this time.