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/cmd/gopls: logger logs wrong direction #30813

Closed
zmb3 opened this issue Mar 13, 2019 · 3 comments
Closed

x/tools/cmd/gopls: logger logs wrong direction #30813

zmb3 opened this issue Mar 13, 2019 · 3 comments
Milestone

Comments

@zmb3
Copy link
Contributor

@zmb3 zmb3 commented Mar 13, 2019

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

$ go version
go version go1.12 darwin/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=""
GOCACHE="/Users/zbergquist/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/zbergquist/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/bv/kylltzdj3fq_9_rgjngc45cc0000gn/T/go-build589970541=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you expect to see?

I just fired up gopls with the log file flag set and expected to see it log the initialize response that it sent.

What did you see instead?

gopls is indicating that it received a response that it actually sent.

[Trace - 2:30:55 PM] Received response 'initialize - (0)' in 1ms.
Params: {"capabilities":{"textDocumentSync":{"openClose":true,"change":1,"save":{}},"hoverProvider":true,"completionProvider":{"triggerCharacters":["."]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"codeActionProvider":true,"codeLensProvider":{},"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"documentLinkProvider":{},"workspace":{"workspaceFolders":{}}}}

This seems to be an error in the following code: https://github.com/golang/tools/blob/dbb4d4be5353aa01a3652094d511f7fe53952a7f/internal/lsp/cmd/serve.go#L84-L88

Am I interpreting this incorrectly or is this indeed a bug? Happy to submit a CL if so.

@gopherbot gopherbot added this to the Unreleased milestone Mar 13, 2019
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 14, 2019

Change https://golang.org/cl/167760 mentions this issue: internal/lsp/cmd: fix direction logged

@ianthehat
Copy link

@ianthehat ianthehat commented Mar 15, 2019

I am not sure, but I think it is correct as it is. There is some weirdness about the logging where it is written by the server but interpreted by the tools as if it were written by the client.
I remember playing with it until https://microsoft.github.io/language-server-protocol/inspector/ gave the right results and then backing slowly away. If you could confirm whether the current log works with that tool, and then whether the change either makes the log start working or breaks it, that would be great.

@zmb3
Copy link
Contributor Author

@zmb3 zmb3 commented Mar 15, 2019

Thanks Ian. Looks like the inspector is happy with it as is. Weirdness indeed 🤷‍♂️

@zmb3 zmb3 closed this Mar 15, 2019
@golang golang locked and limited conversation to collaborators Mar 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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