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

Working in project that uses build tags #1464

Closed
dadgar opened this issue Sep 17, 2017 · 4 comments
Closed

Working in project that uses build tags #1464

dadgar opened this issue Sep 17, 2017 · 4 comments
Assignees
Labels

Comments

@dadgar
Copy link

dadgar commented Sep 17, 2017

Behavior

When working in files that have build tags, not much works. There is the command :GoBuildTags but it isn't pervasive. It would be nice if when you set that completion, go-to's, etc worked. This also applies to test files as well. If I set the build tag and run :GoTestFunc it would be nice for those to be applied rather than having to write :GoTestFunc -tags <tag> every time.

Steps to reproduce:

  1. Create two files, one guarded by a build tag foo and a main.go
  2. Define a struct in the build tag version
  3. Set :GoBuilldTag foo
  4. Try using the struct in the main.go, autocomplete, goto, etc won't work.

Configuration

  • vimrc: Don't think it will be necessary to repro
  • vim version: nvim v0.2.0
  • vim-go version: Latest
  • go version: 1.9.0
@arp242
Copy link
Contributor

arp242 commented Sep 18, 2017

Yeah, :GoBuildTags is somewhat inconsistently applied at the moment.

For the most part adding this should be simple; although some tools may not (fully) support it. For example gocode (which is used for the completion) doesn't seem to: nsf/gocode#390

@arp242 arp242 added the bug label Sep 18, 2017
@arp242 arp242 self-assigned this Sep 25, 2017
@bhcleek
Copy link
Collaborator

bhcleek commented Nov 6, 2017

#1562 added support of g:go_build_tags to the :GoTest family of functions.

@bhcleek
Copy link
Collaborator

bhcleek commented Jan 28, 2018

@Carpetsmoker do you know of any other tools that vim-go uses that we need to add this support to, or should we close this issue since #1562 took care of the :GoTest family of functions?

@dadgar
Copy link
Author

dadgar commented Jan 29, 2018

If this issue is closed it would be nice to see other followup issues be filed for other features that break. I listed a few (goto, autocomplete, etc).

arp242 added a commit that referenced this issue Mar 5, 2018
arp242 added a commit that referenced this issue Mar 5, 2018
Fixes #1464

This also removes the `:GoBuildTags` command. The documentation for
`g:go_build_tags` mentions that "This is a permanent setting. A more
useful way is to use |:GoBuildTags| to dynamically change or remove
build tags", but all `:GoBuildTags` does is change the `go_build_tags`
setting, so I guess that's an artefact from a previous implementation?
We could keep it if people prefer using this, but it seems redundant to
me.

Depends on:

davidrjenni/reftools#14
dominikh/go-tools#272

TODO: Add tests to ensure no silly mistakes were made.
arp242 added a commit that referenced this issue Apr 4, 2018
Fixes #1464

Also fixes `:GoBuildTags ""` to clear the tags. Looks like this didn't
work anymore (probably regression from Billy's config PR? Didn't
investigate too deeply).
arp242 added a commit that referenced this issue Apr 4, 2018
Fixes #1464

Also fixes `:GoBuildTags ""` to clear the tags. Looks like this didn't
work anymore (probably regression from Billy's config PR? Didn't
investigate too deeply).
arp242 added a commit that referenced this issue Apr 5, 2018
Fixes #1464

Also fixes `:GoBuildTags ""` to clear the tags. Looks like this didn't
work anymore (probably regression from Billy's config PR? Didn't
investigate too deeply).
arp242 added a commit that referenced this issue Apr 5, 2018
* Add build tags to many commands

Fixes #1464

Also fixes `:GoBuildTags ""` to clear the tags. Looks like this didn't
work anymore (probably regression from Billy's config PR? Didn't
investigate too deeply).

* Clarify g:go_build_tags docs

* fix typo

* Fix shell escaping for non-async code path

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

No branches or pull requests

3 participants