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

GoImpl does not inserts the implemented functions within the struct definition #1510

Closed
dreamer-nitj opened this issue Oct 14, 2017 · 4 comments

Comments

@dreamer-nitj
Copy link

dreamer-nitj commented Oct 14, 2017

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

I was editing a sample go file and i defined the following struct

type FooStruct struct {
    name string
}

when my cursor is on FooStruct and i type :GoImpl io.WriteCloser, then after the generated code, the file looks like below:

type FooStruct struct {

func (f *FooStruct) Write(p []byte) (n int, err error) {
    panic("not implemented")
}

func (f *FooStruct) Close() error {
    panic("not implemented")
}

    name string
}

Please provide a recipe to replicate your problem with a minimal vimrc with all plugins other than vim-go disabled.

What did you expect to happen?

I expected that the generated code for implemented functions will go after the struct definition ends.

What happened instead?

when my cursor is on FooStruct and i type :GoImpl io.WriteCloser, then after the generated code, the file looks like below:

type FooStruct struct {

func (f *FooStruct) Write(p []byte) (n int, err error) {
    panic("not implemented")
}

func (f *FooStruct) Close() error {
    panic("not implemented")
}

    name string
}

Configuration

vim -version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 27 2017 06:40:24)
Garbage after option argument: "-version"
More info with: "vim -h"

  • vim version (major, minor, and included patches from :version):
  • vim-go version:
    latest from github.com
  • go version (go version):
    go version go1.8.3 darwin/amd64
  • operating system:
    MacOS
  • vimrc you used to reproduce:
@arp242
Copy link
Contributor

arp242 commented Oct 14, 2017

Curious; I made some fixes for this a while ago in #1386, and it seems to work for me with your example, I end up with the methods after the struct.

Could you please:

  • double-check that you're using the latest version of vim-go (e.g. post the output of git log -n1);
  • make sure you have the latest version of impl by running :GoUpdateBinaries;
  • make sure you test this with a minimal vimrc, so we can exclude other some setting or plugins interfering?

Thanks!

@dreamer-nitj
Copy link
Author

dreamer-nitj commented Oct 14, 2017

Attaching the output of the git log -n1

commit 3806c4e59da235e01e0abbe2eefa59053c27b12b (HEAD -> master, origin/master, origin/HEAD)
Author: Fatih Arslan <[email protected]>
Date:   Wed Jun 14 13:31:34 2017 +0300

    Update Changelog.md

@arp242
Copy link
Contributor

arp242 commented Oct 14, 2017

It looks like you're using a version from June (from before my patch), and not the latest version. Your problem should be fixed if you update vim-go.

@dreamer-nitj
Copy link
Author

It works as expected after i pulled latest changes. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants