Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Install gocode-mod and godef-mod failed followd by vscode tips #1979

Closed
Betula-L opened this issue Oct 9, 2018 · 8 comments
Closed

Install gocode-mod and godef-mod failed followd by vscode tips #1979

Betula-L opened this issue Oct 9, 2018 · 8 comments
Labels
go-modules Related to Go modules

Comments

@Betula-L
Copy link

Betula-L commented Oct 9, 2018

If this is a bug report, please share

  • a sample code which can be used to reproduce the issue
  • any Go related settings you might have added/changed

Steps to Reproduce:

(My go extension is https://github.com/Microsoft/vscode-go/releases/download/latest/Go-0.6.91-beta.2.vsix )

  1. Create a empty project
  2. Run go mod init and an empty main.go
  3. Then vscode will instruct user to install gocode-mod

  1. gocode-mod installed failed
Installing 2 tools at /home/mi/go/bin
  gocode-gomod
  gopkgs

Installing github.com/stamblerre/gocode FAILED
Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED

1 tools failed to install.

gocode-gomod:
Error: Command failed: /usr/local/go/bin/go build -o /home/mi/go/bin/gocode-gomod github.com/stamblerre/gocode
# github.com/stamblerre/gocode/internal/suggest
/home/mi/go/src/github.com/stamblerre/gocode/internal/suggest/suggest.go:138:3: cannot use func literal (type func(*token.FileSet, string) (*ast.File, error)) as type func(*token.FileSet, string, []byte) (*ast.File, error) in field value
# github.com/stamblerre/gocode/internal/suggest
/home/mi/go/src/github.com/stamblerre/gocode/internal/suggest/suggest.go:138:3: cannot use func literal (type func(*token.FileSet, string) (*ast.File, error)) as type func(*token.FileSet, string, []byte) (*ast.File, error) in field value
@Scapal
Copy link

Scapal commented Oct 9, 2018

This commit in golang.org/x/tools/go/packages introduces a breaking change:
golang/tools@2f1727f#diff-04792145c70ebd708928684da4875fe9R108

Both github.com/ianthehat/godef and github.com/stamblerre/gocode depend on this.

@yfwz100
Copy link

yfwz100 commented Oct 9, 2018

By changing the function signatures (omitting the third parameter), it seems to work fine.

@ramya-rao-a
Copy link
Contributor

cc @ianthehat, @stamblerre

@pbarker
Copy link

pbarker commented Oct 9, 2018

why use a forked version of godef here? We're somewhat at @ianthehat's mercy as to whether he's even around. Perhaps this is a good time to move upstream if we don't have a compelling reason otherwise

@ramya-rao-a
Copy link
Contributor

@Betula-L Thanks for reporting!

I see that @egonelbre has already submitted a PR to fix the issue for godef. The PR is merged, so godef should be good. Thanks @egonelbre!

@stamblerre has pushed a fix for gocode as well.

All,
Please run Go: Install/Update Tools, select godef-gomod and gocode-gomod, press OK to install/update them.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Oct 9, 2018

@pbarker We use the @ianthehat's forked version of godef to provide the Go to definition feature when using Go modules. You can choose to use gogetdoc instead if you want by adding the setting "go.docsTool": "gogetdoc"

For more details, please see Go modules support in VS Code

@ramya-rao-a ramya-rao-a added the go-modules Related to Go modules label Oct 9, 2018
@pbarker
Copy link

pbarker commented Oct 9, 2018

thanks for the context @ramya-rao-a, would it maybe make sense to fork that into the Microsoft namespace so there are at least multiple people able to push a fix in the event @ianthehat is unavailable?

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Oct 9, 2018

We won't be moving the fork to the Microsoft namespace, because Microsoft doesn't own the fork and neither do we maintain it.

@ianthehat leads the Go tools team in Google and is leading the effort in adding Go modules support in various Go tools in the Go ecosystem. See golang/go#24661. I am working with this team to provide the Go modules support in VS Code.

Today's incident was unfortunate, but it by no way means that @ianthehat is unavailable.

Yes, there was a delay in merging the PR, but I am sure @ianthehat and his team are on top of it to avoid such delays in the future.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-modules Related to Go modules
Projects
None yet
Development

No branches or pull requests

5 participants