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

Run gogetdoc in the dir containing the file #2804

Merged
merged 1 commit into from
Apr 2, 2020

Conversation

andyjack
Copy link
Contributor

@andyjack andyjack commented Apr 2, 2020

My company keeps its go source in a subdir of the main git repo. I typically start vim in the root of the repo. When using K to view the documentation of a keyword in a go file, I get an error (output of gogetdoc) such as:

vim-go: cannot load package containing /my/repo/go/my-daemon/handler/handler.go: go [list -e -json -compiled -test=false -export=false -deps=true -- /my/repo/go/my-daemon/handler]: exit status 1: go: directory go/my-daemon/handler is outside main module

If I pushd go and run vim, the documentation displays as expected, but running vim in this way this complicates some of my non-go editing and plugin setup.

This pr fixes the issue by starting gogetdoc in the dir containing the open file, I presume by making go list able to find the main module.

Thanks!

Copy link
Collaborator

@bhcleek bhcleek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing.

@bhcleek bhcleek merged commit 3ad8780 into fatih:master Apr 2, 2020
@bhcleek bhcleek added this to the vim-go 1.23 milestone Apr 2, 2020
bhcleek added a commit that referenced this pull request Apr 2, 2020
@andyjack andyjack deleted the gogetdoc-chdir branch April 6, 2020 01:23
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 this pull request may close these issues.

2 participants