-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Allow arguments for :Go{Install,Update}Binaries #1467
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a welcome change. Good work @Carpetsmoker.
In the edited docs
If one or more [binaries] are given
reads as if the user can provide zero or more lists, but it's in fact a single optional list. There are other examples in the vim-go docs that we can use for a starting point. Perhaps
If {binaries} is supplied, then only the specified binaries will be ....
I put a couple of other suggestions inline, but feel free to take those or not; they're just suggestions.
plugin/go.vim
Outdated
if go#util#ShellError() != 0 | ||
echo "Error installing ". pkg . ": " . out | ||
echo "Error installing ". pkg[0] . ": " . out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get why pkg[0]
and pkg[1]
are used here, but it it's pretty far from s:packages. For readability, it's probably worth naming giving them meaningful names by assigning their values to variables at the start of the for
loop. Something like:
let l:pkgpath = pkg[0]
let l:gogetflags = (len(pkg) > 1 ? get(pkg[1], l:platform, '') : '')
And then use those instead of pkg[0]
and pkg[1]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks; updated!
\ 'impl': ['github.com/josharian/impl'], | ||
\ 'keyify': ['github.com/dominikh/go-tools/cmd/keyify'], | ||
\ 'motion': ['github.com/fatih/motion'], | ||
\ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want a dictionary here? In every case the key is simply the basename of the first element in the list.
Perhaps this would suffice:
let s:packages = {
\ 'github.com/klauspost/asmfmt/cmd/asmfmt': {}`,
...
\ 'github.com/nsf/gocode': {'windows: '-ldflags -H=windowsgui'},
...
\ }
Food for thought...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started some work on converting this, but it complicates some of the logic by quite a bit (e.g. for filtering the selected packages). I think that keeping it like this is better (a little bit of redundancy in data is better than complicated logic).
I saved the (non-working) patch here: https://gist.github.com/Carpetsmoker/f2003d47f985734c766dff6b68390717
LGTM, but I think you can still simplify the dictionary somewhat. Here's a PoC that's functionally closer to your current implementation, but without the need for an additional function to filter:
If you want to merge as is, then feel free, but perhaps this PoC clears the way for some simplification for you? |
-ldflags -H=windowsgui
when installinggocode
on Windows; fixes gocode installation on Windows with GoInstallBinaries breaks autocomplete #1454