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: VS Code + Go Extension: Debug Console output mysteriously stopped working #49537

Open
shonji-cc opened this issue Nov 12, 2021 · 2 comments

Comments

@shonji-cc
Copy link

@shonji-cc shonji-cc commented Nov 12, 2021

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

$ go version
go version go1.17.3 darwin/arm64

Does this issue reproduce with the latest release?

Yes

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

Big Sur 11.4, Apple M1

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/scotthonji/Library/Caches/go-build"
GOENV="/Users/scotthonji/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/scotthonji/dev/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/scotthonji/dev"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.17.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/st/149ffphn6z1frr4_7pghdsr00000gn/T/go-build4282860168=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Some time following a 'go mod tidy' + 'go get .', I launched one of my long-standing and unmodified launch.json configurations from a workspace opened on (not under, but exactly equal to) $GOPATH. I had been doing this all day long with no problems.

What did you expect to see?

A functioning Debug Console and no extension errors in the status bar.

What did you see instead?

A blank debugger console for build errors and runtime logging, and the following (bogus) error:

"Error loading workspace: You are outside of a module and outside of $GOPATH/src. If you are using modules, please open your editor to a directory in your module. If you believe this warning is incorrect, please file an issue: https://github.com/golang/go/issues/new."

Opening a child module folder, Debug Console output was restored. However, I have a number of local modules in the project and breaking up the workspace I've been using for many months into multiple workspaces just to avoid this issue will tank my efficiency.

I am blocked. I'd really appreciate a quick assist.

Not sure if the mod tidy + get had anything to do with it. All I picked up was Gin-Gonic and friends. Sifting through the diffs of the affected go.mod and go.sum, no dependencies were lost and all new dependencies were present in other modules in the same workspace. It might be a red herring. However I see no other diffs that might explain what happened.

@shonji-cc
Copy link
Author

@shonji-cc shonji-cc commented Nov 12, 2021

This seems pretty relevent: #45015.

Loading

@shonji-cc shonji-cc changed the title VS Code Debug Console output mysteriously stopped working this afternoon VS Code + Go Extension: Debug Console output mysteriously stopped working this afternoon Nov 12, 2021
@shonji-cc shonji-cc changed the title VS Code + Go Extension: Debug Console output mysteriously stopped working this afternoon VS Code + Go Extension: Debug Console output mysteriously stopped working Nov 12, 2021
@seankhliao seankhliao changed the title VS Code + Go Extension: Debug Console output mysteriously stopped working x/tools/gopls: VS Code + Go Extension: Debug Console output mysteriously stopped working Nov 16, 2021
@gopherbot gopherbot added this to the Unreleased milestone Nov 16, 2021
@findleyr
Copy link
Contributor

@findleyr findleyr commented Nov 17, 2021

A blank debugger console for build errors and runtime logging, and the following (bogus) error:

In what way is the error bogus? Are you in $GOPATH/src, or $GOPATH? If the latter, the error message is saying to open $GOPATH/src.

Gopls has experimental multi-module support which you can enable via the experimentalWorkspaceModule setting. This still has bugs, but may help you in the short term. Set it to true and open up a parent directory of the modules you want to work on. (I think you need to be outside of GOPATH though).

Longer term (~months) we will be integrating support for the new go.work workspace files.

Loading

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
3 participants