Che: Go devfile LS Not working without updating Go language server plugin to the experimental version.

Created on 24 Feb 2020  路  25Comments  路  Source: eclipse/che

Describe the bug

Go devfile is showing notification about updating the version of Go vsix plugin and a warning regarding development tools missing in the path installation.

Che version

7.9.0-SNAPSHOT

  • [x] latest
  • [x] nightly
  • [ ] other: please specify

Steps to reproduce

  • Open a Go getting started devfile
  • Open any .go script
  • Next to the notifications in the bottom bar on a right side you will see a notification about missing development tools and outdated plugin

Expected behavior

No errors/warnings are present

Runtime

  • [ ] kubernetes (include output of kubectl version)
  • [x] Openshift (include output of oc version) 4.3, 4.2
  • [ ] minikube (include output of minikube version and kubectl version)
  • [ ] minishift (include output of minishift version and oc version)
  • [ ] docker-desktop + K8S (include output of docker version and kubectl version)
  • [ ] other: (please specify)

Screenshots

Screenshot_20200255_161009_closeup

image

Installation method

  • [x] chectl -a operator -p openshift --ssl --self-signed-cert
  • [ ] che-operator
  • [ ] minishift-addon
  • [ ] I don't know

Environment

  • [ ] my computer

    • [ ] Windows

    • [ ] Linux

    • [ ] macOS

  • [ ] Cloud

    • [ ] Amazon

    • [ ] Azure

    • [ ] GCE

    • [x] other (please specify) ocp42.codereadyqe.com

  • [ ] other: please specify
arelanguages kinbug severitP1 tealanguages

All 25 comments

@ScrewTSW how this affects UX with Go, other than warning?

It is interesting to check Go LS features if they still work.

@ibuziuk @tolusha No. The error highlighting and code completion only work once the GO.vsix plugin is updated. But even after updating the vsix plugin, the toolchain is saying that the binary is missing.

Strange thing is that it's a one-time thing per deployment.
Once you do the update through theia, the stacks always work correctly - with the updated plugin the error highlighting and code completion works correctly.

I will try to reinstall che again and capture a screenshot of the message.

Setting P1 after discussion with Tibor, looks like Go devfile is broken atm

Pre update:
Screenshot_20200225_161507
Screenshot_20200225_161009
Update log:

Installing 1 tool at /go/bin
  gopls
Starting building the current package at /projects/src/github.com/golang/example/outyet
Not able to determine import path of current package by using cwd: /projects/src/github.com/golang/example/outyet and Go workspace: /projects/src
Starting building the current package at /projects/src/github.com/golang/example/outyet
Not able to determine import path of current package by using cwd: /projects/src/github.com/golang/example/outyet and Go workspace: /projects/src
Installing golang.org/x/tools/cmd/gopls FAILED
1 tools failed to install.
gopls:
Error: Command failed: /usr/local/go/bin/go get -u -v golang.org/x/tools/cmd/gopls
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Installing golang.org/x/tools/cmd/gopls FAILED
1 tools failed to install.
gopls:
Error: Command failed: /usr/local/go/bin/go get -u -v golang.org/x/tools/cmd/gopls
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Installing golang.org/x/tools/cmd/gopls FAILED
1 tools failed to install.
gopls:
Error: Command failed: /usr/local/go/bin/go get -u -v golang.org/x/tools/cmd/gopls
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Installing golang.org/x/tools/cmd/gopls FAILED
1 tools failed to install.
gopls:
Error: Command failed: /usr/local/go/bin/go get -u -v golang.org/x/tools/cmd/gopls
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
Fetching https://golang.org/x/tools/cmd/gopls?go-get=1
https fetch failed: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority
package golang.org/x/tools/cmd/gopls: unrecognized import path "golang.org/x/tools/cmd/gopls" (https fetch: Get https://golang.org/x/tools/cmd/gopls?go-get=1: x509: certificate signed by unknown authority)
/projects/src/github.com/golang/example/outyet>Finished running tool: /usr/local/go/bin/go build -o /tmp/vscode-goPfiPhe/go-code-check .
/projects/src/github.com/golang/example/outyet/main.go:20: syntax error: non-declaration statement outside function body
/projects/src/github.com/golang/example/outyet>Finished running tool: /usr/local/go/bin/go build -o /tmp/vscode-goPfiPhe/go-code-check .
/projects/src/github.com/golang/example/outyet/main.go:20: syntax error: non-declaration statement outside function body

After "Reload"
Screenshot_20200225_161826
Screenshot_20200225_161736

I _thought_ a solution to this might be setting the che go plugin preference go.useLanguageServer: true in the devfile (it would get rid of the popup) but for some reason the golang language server features only work on the first go file opened (which is an issue in itself regardless)

From my experience with this plugin on the vscode side, gopls leaves a lot to be desired but is required for module projects, so should be enabled by default in the plugin if possible.

Which analysis tools are missing? They should be added to the go sidecar, since /go is not persisted.

@amisevsk I think it was refering to gopls as a missing tool from the toolchain

@ScrewTSW gopls is only required when the "experimental" language server is enabled; since the analysis tools popup appears before it's enabled, it suggests that something else is missing. If you get the notification again, it should output which analysis tools its installing.

Either way, I'm +1 on adding gopls to the golang sidecar.

I just tried on che.openshift.io and it looks like the problem is that it's missing golangci-lint. I'm guessing this issue was introduced when the preference was changed in the devfile? https://github.com/eclipse/che-devfile-registry/blob/master/devfiles/go/devfile.yaml#L19.

If I start a workspace and remove that preference the Analysis Tools Missing error doesn't pop up.

Edit: It looks like golangci-lint and gopls are both installed in the dockerfile: https://github.com/che-dockerfiles/che-sidecar-go/blob/1.12.9/Dockerfile#L72

golangci-lint is installed, except the binary ends up in /usr/local/go/src/bin instead of /usr/local/go/bin, leaving it outside of the path (note this directory is not standard and is created during the golangci-lint install). The script used to install it outputs to ./bin for the current working directory.

Hi guys, is there any progress on that issue? This issue is still present in 7.10.0-SNAPSHOT.

Can somebody describe what to do if notifications with update suggestions missed?
Do we have any way to update LS except notification confirmation?

The notification appears with every workspace startup until the plugin is updated.

@ScrewTSW Could you please describe steps for updating LS if update suggestions missed?

@Ohrimenko1988

  • restart workspace
  • open a .go file
  • wait for LS initialization and notification pop-up:
    Screenshot_20200312_162253
  • click "Update"
  • wait for installation, new notification will pop-up:
    Screenshot_20200312_162310
  • click "Reload"

The fix for this issue would be to add it to the che-sidecar-go image (go get gopls) during the build. Then we could update the settings in the plugin to use the lang server, removing the prompt.

If you miss the prompt, nothing bad happens (provided all the regular tools are installed), but it will return if you try to work on a project that uses go modules.

@amisevsk But the title of this issue "Go devfile Not working without updating Go language server to the experimental version." and according to this I suppose if you missed notification the Go language server will not work. Am I right?

@amisevsk But the title of this issue "Go devfile Not working without updating Go language server to the experimental version." and according to this I suppose if you missed notification the Go language server will not work. Am I right?

fixed the issue name

@rhopp found out that the problem, and why after update the LS works across the same workspace type after deletion/restarts is that what fixes the language server is a simple user preference setting:

"go.useLanguageServer": true

After setting that preference the golang devfile LS works correctly

@rhopp found out that the problem, and why after update the LS works across the same workspace type after deletion/restarts is that what fixes the language server is a simple user preference setting:

"go.useLanguageServer": true

After setting that preference the golang devfile LS works correctly

So this is what's required to fix this issue, just the one setting? Or updating the Go LS plugin also needs to happen?

"go.useLanguageServer": true

I've created a new user, opened swagger and pushed

{
  "theia-user-preferences": "{\"application.confirmExit\":\"never\",\"workbench.iconTheme\":\"theia-file-icons\",\"go.useLanguageServer\":true}",
  "temporary": "false",
  "codenvy:created": "1584108807687"
}

to the preferences endpoint and then tried to open a new golang devfile.

the fix seems to be working even on newly created users that haven't been touched previously.

I believe the work here is done.

But the error highlighting isn't working yet. (Info from Tibor Dancs)

Was this page helpful?
0 / 5 - 0 ratings