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: gopls stopped responding when gomod failed. #38818

Closed
ehrktia opened this issue May 2, 2020 · 6 comments
Closed

x/tools/gopls: gopls stopped responding when gomod failed. #38818

ehrktia opened this issue May 2, 2020 · 6 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@ehrktia
Copy link

ehrktia commented May 2, 2020

Please answer these questions before submitting your issue. Thanks!

What did you do?

using vim+coc-nvim+gopls for autocompletion,documentation,reference.

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 13 2020 07:47:09)
macOS version
Included patches: 1-550
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_old_static
+arabic            +file_in_path      +mouse_urxvt       -tag_any_white
+autocmd           +find_in_path      +mouse_xterm       -tcl
+autochdir         +float             +multi_byte        +termguicolors
-autoservername    +folding           +multi_lang        +terminal
-balloon_eval      -footer            -mzscheme          +terminfo
+balloon_eval_term +fork()            +netbeans_intg     +termresponse
-browse            +gettext           +num64             +textobjects
++builtin_terms    -hangul_input      +packages          +textprop
+byte_offset       +iconv             +path_extra        +timers
+channel           +insert_expand     +perl              +title
+cindent           +job               +persistent_undo   -toolbar
-clientserver      +jumplist          +popupwin          +user_commands
+clipboard         +keymap            +postscript        +vartabs
+cmdline_compl     +lambda            +printer           +vertsplit
+cmdline_hist      +langmap           +profile           +virtualedit
+cmdline_info      +libcall           -python            +visual
+comments          +linebreak         +python3           +visualextra
+conceal           +lispindent        +quickfix          +viminfo
+cryptv            +listcmds          +reltime           +vreplace
+cscope            +localmap          +rightleft         +wildignore
+cursorbind        +lua               +ruby              +wildmenu
+cursorshape       +menu              +scrollbind        +windows
+dialog_con        +mksession         +signs             +writebackup
+diff              +modify_fname      +smartindent       -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary

coc-settings

{
    "languageserver": {
    "golang": {
      "command": "gopls",
       "args": ["serve", "-debug", "0.0.0.0:8484", "-rpc.trace"],
      "filetypes": ["go"],
      "trace.server": "verbose",
      "initializationOptions": {
          "usePlaceholders":true,
          "completeUnimported":true
      }
    }
    }
}

vimrc

nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

Any project with issue in go.mod i.e - if the go.mod is not able to fetch all relevant dependencies from source, then gopls stops working.
Gopls version

% gopls version
golang.org/x/tools/gopls 0.4.0
    golang.org/x/tools/gopls@v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik=

Any sample program with simple print works as expected, gopls works fine.

package main
import "log"
func main(){
log.Println("hello")
}

In case of larger project with long list of dependencies and if any one of the package is missing / version in compatable then gopls stops responding.
Due to sensitivity of work the program can not be provided.
Part of trace information cleansed is below.


    0s initialized 268.514426ms name="initialized" method="initialized" direction="in" id=""
        11.905581ms message="Build info\n----------\ngolang.org/x/tools/gopls 0.4.0\n golang.org/x/tools/gopls@v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik=\n github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\n github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\n golang.org/x/mod@v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=\n golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=\n golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea h1:DUwLyMDMUauGMd9kSLIlhhYJNELm06HuxeBdkFkeax4=\n golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=\n honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=\n mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=\n\nGo info\n-------\ngo version go1.13.9 darwin/amd64\n\n"
        268.471989ms message="go env for /Users/karthickayyapillai/go/src/gitlab.dol.telekom.de/Access40/dev/pao-access-fabric\n(valid build configuration = true)\n(build flags: [])\nGO111MODULE=\"\"\nGOARCH=\"amd64\"\nGOBIN=\"\"\nGOCACHE=\"/Users/karthickayyapillai/Library/Caches/go-build\"\nGOENV=\"/Users/karthickayyapillai/Library/Application Support/go/env\"\nGOEXE=\"\"\nGOFLAGS=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"darwin\"\nGONOPROXY=\"gitlab.\"\nGONOSUMDB=\"gitlab.\"\nGOOS=\"darwin\"\nGOPATH=\"/Users/karthickayyapillai/go\"\nGOPRIVATE=\"gitlab."\nGOPROXY=\"https://proxy.golang.org,direct\"\nGOROOT=\"/usr/local/go\"\nGOSUMDB=\"sum.golang.org\"\nGOTMPDIR=\"\"\nGOTOOLDIR=\"/usr/local/go/pkg/tool/darwin_amd64\"\nGCCGO=\"gccgo\"\nAR=\"ar\"\nCC=\"clang\"\nCXX=\"clang++\"\nCGO_ENABLED=\"1\"\nGOMOD=\"/Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXX/go.mod\"\nCGO_CFLAGS=\"-g -O2\"\nCGO_CPPFLAGS=\"\"\nCGO_CXXFLAGS=\"-g -O2\"\nCGO_FFLAGS=\"-g -O2\"\nCGO_LDFLAGS=\"-g -O2\"\nPKG_CONFIG=\"pkg-config\"\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d1/bx5v073n31795zvpt7qpx_s00000gp/T/go-build342473829=/tmp/go-build -gno-record-gcc-switches -fno-common\"\n"
        268.508925ms status.code="OK" 
        23.866µs queued 34.741µs name="queued"
        132.938µs client/registerCapability 4.40815ms name="client/registerCapability" method="client/registerCapability" direction="out" id="#1"
            4.529498ms status.code="OK" 
        12.059658ms workspace/configuration 1.698096ms name="workspace/configuration" method="workspace/configuration" direction="out" id="#2"
            13.752599ms status.code="OK" 
        12.158154ms window/logMessage 108.037µs name="window/logMessage" method="window/logMessage" direction="out" id=""
            12.264955ms status.code="OK" 
        164.560339ms cache.view.load 6m16.187124325s name="cache.view.load" query=[./... builtin]
            0s message="go/packages.Load" snapshot=0 directory=/Users/karthickayyapillai/go/src/gitlab.XXXXX/XXX/dev/XXXXXXX=[./... builtin] packages=0 


Coc-workspace output

Params: {
    "textDocument": {
        "uri": "file:///Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXXX/main.go"
    },
    "position": {
        "line": 49,
        "character": 10
    }
}
[Trace - 22:59:55.471 PM] Sending request 'textDocument/definition - (22)'.
Params: {"textDocument":{"uri":"file:///Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXXX/main.go"},"position":{"line":49,"character":10}}


Params: {
    "textDocument": {
        "uri": "file:///Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXXX/main.go"
    },
    "position": {
        "line": 49,
        "character": 10
    }
}
[Trace - 23:00:01.592 PM] Sending request 'textDocument/hover - (23)'.
Params: {"textDocument":{"uri":"file:///Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXXX/main.go"},"position":{"line":49,"character":10}}


Params: {
    "id": 22
}
[Trace - 23:00:06.597 PM] Sending notification '$/cancelRequest'.
Params: {"id":22}

[Error - 23:00:06.603 PM] Received #22 getting file for Identifier: context canceled


Params: {
    "textDocument": {
        "uri": "file:///Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXXX/main.go"
    },
    "position": {
        "line": 51,
        "character": 10
    }
}
[Trace - 23:00:28.142 PM] Sending request 'textDocument/hover - (24)'.
Params: {"textDocument":{"uri":"file:///Users/karthickayyapillai/go/src/gitlab.XXXX/XXXX/dev/XXXX/main.go"},"position":{"line":51,"character":10}}


Params: {
    "id": 23
}
[Trace - 23:00:33.142 PM] Sending notification '$/cancelRequest'.
Params: {"id":23}

[Trace - 23:00:33.150 PM] Received response 'textDocument/hover - (23)' in 31557ms.
Result: {}


What did you expect to see?

jump to definition , display documentation when dohover over the funcs.show implementation list when issued corresponding command over the interface/function.
gopls to work independent of gomod status.

What did you see instead?

No response/reply from gopls.

Build info

golang.org/x/tools/gopls 0.4.0
    golang.org/x/tools/gopls@v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
    golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
    golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea h1:DUwLyMDMUauGMd9kSLIlhhYJNELm06HuxeBdkFkeax4=
    golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
    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.13.9 darwin/amd64

Not sure if this is issue , or expected behaviour from gopls.Is gopls depndent on gomod being successful?
If you require more details please let me know.

@gopherbot gopherbot added this to the Unreleased milestone May 2, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 2, 2020
@gopherbot
Copy link

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
Copy link
Contributor

Thanks for reporting. We have a few opened issues that cover some of the bugs you mention here - #38232, #38383, #38462. Does this cover everything you've encountered, or are there other issues that are missing?

BTW, make sure to set GOPRIVATE when working with private modules in gopls, if you haven't already.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 May 5, 2020
@ehrktia
Copy link
Author

ehrktia commented May 5, 2020

Thanks for replying back, yes I had set GOPRIVATE in my go env. Not sure what do you mean by set goprivate in gopls.

@stamblerre
Copy link
Contributor

Ok, yeah, setting GOPRIVATE in your environment is all you have to do for gopls. Do the issues linked above cover the issues you encountered? If so, I'll go ahead and close this in favor of those issues.

@ehrktia
Copy link
Author

ehrktia commented May 5, 2020

Yes please 38232- covers the go mod incorrect version of dependency.

@stamblerre
Copy link
Contributor

Ok thanks for confirming!

@stamblerre stamblerre modified the milestones: gopls/v0.5.0, gopls/v0.4.1 May 13, 2020
@golang golang locked and limited conversation to collaborators May 13, 2021
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants