I'm working on a gb project, and while :GoPath reports the correct folder(gb project) echo $GOPATH reports the default $GOPATH. This is causing syntastic to fail with "package not found in path" error whenever there is an import of another gb package(from the same project folder).
This issue is specific to syntastic. Using GoBuild does not cause any errors.
I also noticed that my gb path contains both pkg paths named darwin-amd64 and darwin_amd64.
My environment:
Shell - ZSH(GOPATH defined in zshrc)
editor - nvim
nvimrc:
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'fatih/vim-go'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-fugitive'
Plugin 'Valloric/YouCompleteMe'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'markcornick/vim-terraform'
Plugin 'robbles/logstash.vim'
Plugin 'jeffkreeftmeijer/vim-numbertoggle'
Plugin 'scrooloose/syntastic'
Plugin 'rodjek/vim-puppet'
Plugin 'tomtom/tcomment_vim'
Plugin 'mxw/vim-jsx'
Plugin 'rizzatti/dash.vim'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'edsono/vim-matchit'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
"My Config
"
"
let mapleader = ","
set rnu
syntax enable
let g:rehash256 = 1
let g:go_fmt_command = "goimports"
set splitright
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
gb project folder structure:
.
โโโ Dockerfile
โโโ Dockerfile.build
โโโ Makefile
โโโ README.md
โโโ bin
โย ย โโโ planc
โโโ db
โย ย โโโ dbconf.yml
โย ย โโโ dev.db
โย ย โโโ migrations
โโโ pkg
โย ย โโโ darwin-amd64
โย ย โโโ darwin_amd64
โโโ src
โย ย โโโ planc
โโโ vendor
โโโ manifest
โโโ pkg
โโโ src
Hi @groob I'm not responsible of Syntastic. If you have a problem with vim-go please let me know, otherwise I don't have much to do or say here.
@groob I have got exactly the same issue. Syntastic calls go build which is unaware of the gopath which vim-go sets.
It would be great if @fatih considered overwriting $GOPATH once vim-go successfully detected it.
As a workaround, I added the following to my vim configuration:
au FileType go let $GOPATH = go#path#Detect()
@vaijab I wrote a gb syntax checker, but the PR was rejected from syntactic, even though it works fine with gb and vim.
If you'd like to use it, you can download it and add it your folder under syntax checkers https://github.com/groob/syntastic/blob/gb_checker/syntax_checkers/go/gb.vim
Most helpful comment
@groob I have got exactly the same issue. Syntastic calls
go buildwhich is unaware of the gopath which vim-go sets.It would be great if @fatih considered overwriting
$GOPATHonce vim-go successfully detected it.As a workaround, I added the following to my vim configuration: