maybe a bug report.
fix the error alert.
when I try to save go file, there is a error message alert:
Error detected while processing function <SNR>73_fmt_autosave..go#fmt#Format..go#fmt#run..<SNR>115_fmt_cmd:
line 8:
E706: Variable type mismatch for: opts
line 10:
"main.go" 14L, 212C written
vim-go version: commit afbfc3765335626b21be2d656f22aecfcb125781
vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):
I don't know how to cut the vimrc for short. full link: vimrc
Vim version (first three lines from :version):
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 2 2017 00:45:39)
Go version (go version):
go version go1.10.1 linux/amd64
go env):GOARCH="amd64"
GOBIN=""
GOCACHE="/home/stduolc/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/stduolc/go"
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build542396851=/tmp/go-build -gno-record-gcc-switches"
I fix it. I checkout to the v1.17 release version.
What is the value of your g:go_fmt_options?
@bhcleek nothing, I didn't set the g:go_fmt_options.
this is the output:
:let g:go_fmt_options
g:go_fmt_options
setting let g:go_fmt_options = 0 in my .vimrc stopped this from occuring. I switch to the tag v1.17 prior to setting that in my .vimrc, but that didn't help 馃檨
let g:go_fmt_options = 0 disabled the go fmt that was happening on save, so I switch it to let g:go_fmt_options = '', and it appears to be formatting properly now.I have the same issue to save go file on master. Checkout to v1.7, v1.8 or v1.9 can fix the problem.
Any ideas how I can fix it?
@stduolc it appears that you're using an old version of Vim that vim-go does not support. vim-go currently requires _at least_ Vim 7.4.2009
Most helpful comment
setting
let g:go_fmt_options = 0in my .vimrc stopped this from occuring. I switch to the tag v1.17 prior to setting that in my .vimrc, but that didn't help 馃檨let g:go_fmt_options = 0disabled the go fmt that was happening on save, so I switch it tolet g:go_fmt_options = '', and it appears to be formatting properly now.