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

Misleading usage error for GoImpl #3521

Closed
flwyd opened this issue Feb 16, 2023 · 0 comments · Fixed by #3522
Closed

Misleading usage error for GoImpl #3521

flwyd opened this issue Feb 16, 2023 · 0 comments · Fixed by #3522

Comments

@flwyd
Copy link

flwyd commented Feb 16, 2023

What did you do? (required: The issue will be closed when not provided)

  1. Create a type like type foo []string
  2. Try to implement an interface like :GoImpl foo flag.Value

What did you expect to happen?

An error message explaining that :GoImpl takes three arguments: a receiver name, a receiver type, and an interface, e.g. GoImpl {r} {receiver} {interface}

What happened instead?

An error message like vim-go: usage: GoImpl {receiver} {interface}. This message looks like it's telling me that it takes two arguments (receiver type and interface type), which led me to try several variations on specifying the type. Further adding to the confusion, the impl command will happily accept a bare type name as its first argument, producing code without a named receiver, e.g. func (foo) String() string {…}.

Configuration (MUST fill this out):

vim-go version:

Commit 8d7677947e0be1eecfa1bcf2c1148804963ec4f6

vimrc you used to reproduce:

vimrc
" No special configuration needed, just use the vim-go plugin

Vim version (first three lines from :version):

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 12 2022 20:02:12)
macOS version - x86_64
Included patches: 1-1023

Go version (go version):

go version go1.20 darwin/amd64

Go environment

go env Output:

gopls version

gopls version Output:
golang.org/x/tools/gopls v0.11.0
    golang.org/x/tools/gopls@v0.11.0 h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY=
bhcleek added a commit to bhcleek/vim-go that referenced this issue Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant