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

Gometalinter integration #553

Merged
merged 11 commits into from
Sep 30, 2015
Merged

Gometalinter integration #553

merged 11 commits into from
Sep 30, 2015

Conversation

fatih
Copy link
Owner

@fatih fatih commented Sep 29, 2015

This PR adds a new command called :GoMetaLinter which uses the gometalinter tool. Because gometalinter invokes other tools to gather the final output some of can be canceled on big source code calls. This can be of course changed with flags passed to gometalinter. I've decided to limit it and make it a little bit more usable for Vim. So our command :GoMetaLinter is a little bit restricted, but with option to totally change the behavior how it would work.

For now we have the following settings:

let g:go_metalinter_command = ""
let g:go_metalinter_enabled = ['vet', 'golint']
let g:go_metalinter_path = "./..."

This causes the following command to be generated and executed:

gometalinter --disable-all --enable=vet --enable=golint ./...

To add/remove linters just change it for your own needs:

let g:go_metalinter_enabled = ['vet', 'golint', 'deadcode', 'errcheck']

However, if the user change the g:go_metalinter_command command to something different, vim-go will call the command without modifying anything. Example (which basically calls all default linters specified by gometalinter):

let g:go_metalinter_command = "gometalinter ./..."

Right now this is how it looks like and everything seems to work perfect:

image

We also have a mapping to invoke it easily. For example the following calls :GoMetaLinter with the shortcut bound to <Leader>l:

au FileType go nmap <Leader>l <Plug>(go-metalinter)

Todos:

  • Add :GoMetaLinter command
  • Specify the list of linters explicitly with g:go_metalinter_enabled
  • Override the generated command if the user wants to control with itself with g:go_metalinter_command
  • Pass directory as argument to :GoMetaLinter
  • Add documentation and update readme
  • Add mapping so we can easily invoke it

Fixes #320

@fatih
Copy link
Owner Author

fatih commented Sep 30, 2015

This is now finished, will be a part of our upcoming release.

fatih added a commit that referenced this pull request Sep 30, 2015
@fatih fatih merged commit 8e372df into master Sep 30, 2015
@fatih fatih deleted the gometalinter branch October 1, 2015 21:57
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.

None yet

2 participants