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

Add build tags 'g:go_build_tags' for gogetdoc #1702

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autoload/go/doc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ function! s:gogetdoc(json) abort
let pos = shellescape(fname.':#'.offset)

let cmd += ["-pos", pos]

if exists('g:go_build_tags')
let cmd += ["-tags", get(g:, 'go_build_tags')]
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you test that this will work with multiple build tags? I'm, not 100% sure, but I think you need to do:

['-tags', go#util#Shellescape(get(g:, 'go_build_tags'))]

So that g:go_build_tags='foo bar' will be:

gogetdoc -tags 'foo bar' someident

Instead of:

gogetdoc -tags foo bar someIdent

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are right, sorry for that changes. I had read the doc about build constraints again.
And I saw your commit #1705. That's much better. Thanks for your advice.

endif

if a:json
let cmd += ["-json"]
endif
Expand Down