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: use xerrors package #31374

Closed
bstaletic opened this issue Apr 9, 2019 · 6 comments
Closed

x/tools/gopls: use xerrors package #31374

bstaletic opened this issue Apr 9, 2019 · 6 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@bstaletic
Copy link

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

$ go version
go version go1.12.1 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=""
GOCACHE="/home/bstaletic/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bstaletic/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build434682588=/tmp/go-build -gno-record-gcc-switches"

What did you do?

This is basically a continuation of #31194. This time I'm having troubles getting to gopls' log.

Steps to reproduce:

  • Follow all but the final two steps in x/tools/internal/lsp: gopls hangs on a testdata workspace #31194 (basically, setup ycmd and open a go file).
  • Currently, the gopls command line is gopls -logfile /tmp/gopls_$PID_$RANDOM.log
    • The file and its name is generated by ycmd.
  • If the log path is hardcoded (to somthing like /home/bstaletic/go.log), the empty log file gets created but nothing is written to the file.

What did you expect to see?

Some content in the log, to help me debug things.

What did you see instead?

Empty log whose size was 0bytes.

@ianthehat
Copy link

try adding -rpc.trace and it will log all the rpc messages

@ianthehat ianthehat added the gopls Issues related to the Go language server, gopls. label Apr 10, 2019
@bstaletic
Copy link
Author

Thanks. That did work. Is there also a way to log tracebacks when an error is returned?

@bcmills bcmills changed the title gopls doesn't write its log x/tools/cmd/gopls: doesn't write its log Apr 10, 2019
@gopherbot gopherbot added this to the Unreleased milestone Apr 10, 2019
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 10, 2019
@stamblerre
Copy link
Contributor

Not right now, but we should switch to using the https://golang.org/x/xerrors package so that we can do that.

@stamblerre stamblerre changed the title x/tools/cmd/gopls: doesn't write its log x/tools/internal/lsp: use xerrors May 21, 2019
@bstaletic
Copy link
Author

Thanks for the response. For what it's worth, I did make a PR for our project to use gopls instead of gocode and godef.

ycm-core/ycmd#1243

@stamblerre stamblerre added the Suggested Issues that may be good for new contributors looking for work to do. label May 31, 2019
@stamblerre stamblerre changed the title x/tools/internal/lsp: use xerrors x/tools/internal/lsp: use xerrors package Jun 5, 2019
@jan-xyz
Copy link

jan-xyz commented Jun 6, 2019

I would like to take on this issue, what's the best way to start?

@stamblerre stamblerre changed the title x/tools/internal/lsp: use xerrors package x/tools/gopls: use xerrors package Jul 2, 2019
@stamblerre stamblerre added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 3, 2019
gopherbot pushed a commit to golang/tools that referenced this issue Aug 6, 2019
This relates to golang/go#31374 and should switch all instances within `gopls` to use `x/errors` instead of `fmt` to create new errors.

Change-Id: I18339b75d12418d852e0dcc2ba0ed6c2970783b3
GitHub-Last-Rev: f4a55d9
GitHub-Pull-Request: #108
Reviewed-on: https://go-review.googlesource.com/c/tools/+/179880
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@stamblerre
Copy link
Contributor

Thanks for contributing this, @jan-xyz! Closing this issue since https://golang.org/cl/179880 has been submitted.

@golang golang locked and limited conversation to collaborators Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

6 participants