Skip to content

Instantly share code, notes, and snippets.

@samsalisbury
Created May 8, 2018 16:52
Show Gist options
  • Save samsalisbury/a8124560c15066b5e6d3b32875092b47 to your computer and use it in GitHub Desktop.
Save samsalisbury/a8124560c15066b5e6d3b32875092b47 to your computer and use it in GitHub Desktop.
Getting vim-go and syntastic playing nicely with go build tags.
# First update vim-go and syntastic to latest versions.
# Then install/update go tools using :GoInstallBinaries and :GoUpdateBinaries
# Set default go build tags... Update ad-hoc with :GoBuildTags <new list>
let g:go_build_tags = "smoke integration"
# Get Syntastic to use build tags...
let g:syntastic_go_go_test_args = '-tags="smoke integration"'
let g:syntastic_go_go_build_args = '-tags="smoke integration"'
# Set go guru scope to current Git repo root... Update ad-hoc with :GoGuruScope if needing to include code outside of repo root.
let root_import_path = system("ABS=$(git rev-parse --show-toplevel); echo \${ABS#$GOPATH/src/}")
let g:go_guru_scope = [root_import_path]
# Other settings I find useful for go/syntastic...
let g:go_fmt_command = "goimports"
let g:go_fmt_autosave = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_go_checkers = ['go', 'errcheck', 'golint', 'govet', ]
let g:go_list_type = "quickfix"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment