vim-go not showing GoFmt errors

Created on 11 May 2016  路  8Comments  路  Source: fatih/vim-go

Actual behavior

Normally when I save a file, vim-go will show the errors in the gutter, in airline etc ... but now I see nothing. If I run GoFmt manually I will actually see the following though:

Gofmt returned error

Expected behavior

vim-go should show errors in gutter and airline etc.

Steps to reproduce:

Here's the vimrc I was able to create:

execute pathogen#infect()
execute pathogen#helptags()

let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_array_whitespace_error = 1
let g:go_highlight_chan_whitespace_error = 1
let g:go_highlight_space_tab_error = 1
let g:go_highlight_trailing_whitespace_error = 1
let g:go_textobj_enabled = 1
let g:go_auto_type_info = 1
let g:go_fmt_command = "goimports"

The vim bundles I have installed are:

YouCompleteMe      nerdtree           tagbar             vim-airline-themes vim-gitgutter      vim-godef
delimitMate        syntastic          vim-airline        vim-fugitive       vim-go             vim-indent-guides

Configuration

  • vim version:
vim --version
NVIM 0.1.4
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/build/config -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/src -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include/luajit-2.0 -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/deps-build/usr/include -I/usr/local/opt/gettext/include -I/usr/include -I/usr/include -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/build/src/nvim/auto -I/tmp/neovim-20160509-73945-nwgcvk/neovim-0.1.4/build/include
Compiled by jseaidoun@jseaidoun
  • vim-go version: HEAD
  • go version : go version go1.6.2 darwin/amd64

Most helpful comment

The change is likely due to this recent update in syntastic: https://github.com/scrooloose/syntastic/commit/f280ff22207ffcddaabc8557d32ceaae03aa3975

To enable Syntastic with Go, add this to your vimrc:

" Synastic doesn't check Go files on save by default (anymore), this restores that behaviour
let g:syntastic_go_checkers = ['go']

See if that resolves the issue, else it may have been unrelated.

All 8 comments

Hi @jseaidou

vim-go doesn't have support for airline or gutter.

Thanks

@fatih It might not support them but it is also not giving the errors it should when its supposed to run gofmt on save there are still no errors showing up until I manually run it

@fatih same issue here but other than that doesn't even show any errors like syntax or wrong variable names etc...

The change is likely due to this recent update in syntastic: https://github.com/scrooloose/syntastic/commit/f280ff22207ffcddaabc8557d32ceaae03aa3975

To enable Syntastic with Go, add this to your vimrc:

" Synastic doesn't check Go files on save by default (anymore), this restores that behaviour
let g:syntastic_go_checkers = ['go']

See if that resolves the issue, else it may have been unrelated.

@bradleyfalzon I tried with:

let g:syntastic_go_checkers = ['go', 'golint', 'govet', 'errcheck']

Still same issue

Oh, for me the issue was this line in my .vimrc:

let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }

@bradleyfalzon was right, but I added this:

let g:syntastic_go_checkers = "gofmt"

can confirm, removing let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } brought back errors in vim.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrejvanderzee picture andrejvanderzee  路  3Comments

korjavin picture korjavin  路  4Comments

danielmanesku picture danielmanesku  路  4Comments

zhangjing picture zhangjing  路  3Comments

svanharmelen picture svanharmelen  路  3Comments