Vim-go: I have some issues when I save go file.

Created on 17 May 2018  路  7Comments  路  Source: fatih/vim-go

What did you do? (required. The issue will be closed when not provided.)

maybe a bug report.

What did you expect to happen?

fix the error alert.

What happened instead?

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

Configuration (MUST fill this out):

  • 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 environment (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"

Most helpful comment

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 馃檨

  • Update, switching to 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.

All 7 comments

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 馃檨

  • Update, switching to 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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joeblubaugh picture joeblubaugh  路  3Comments

wpaulino picture wpaulino  路  4Comments

preslavmihaylov picture preslavmihaylov  路  3Comments

johnzeng picture johnzeng  路  3Comments

Michael-F-Ellis picture Michael-F-Ellis  路  3Comments