Ran :GoImports on the following file:
package eventsource
type Indexer interface {
Get(region string) *eventbridge.EventSource
}
The expected import is github.com/aws/aws-sdk-go/service/eventbridge. The module is already present in go.mod and pre-cached.
:GoImports runs silently and without error.
Upon calling :GoImports, the following error message is printed
Error detected while processing function <SNR>79_highlightMatches[10]..go#util#HighlightPositions:
line 32:
E964: Invalid column number: 6
Press ENTER or type command to continue
After pressing ENTER, the buffer is refreshed and the import is added despite the error.
It does not happen consistently, but often enough, more often(?) on new files.
7fef39e
vimrc you used to reproduce:
vimrc
" ================== Vim-Go ==================
let g:go_highlight_function_arguments = 1 " highlight function and method declarations, as well as variable names
" in arguments and return values in function declarations
let g:go_highlight_function_calls = 1 " highlight function and method calls
let g:go_highlight_variable_declarations = 1 " highlight variable names in variable declarations
let g:go_rename_command = 'gopls' " rename using gopls instead of gorename
let g:go_echo_command_info = 0 " disable echoing of commands, redundant with status bar
" ================== Formatting ==================
filetype plugin on " load filetype specific plugins
filetype indent on " load filetype specific indentations
set autoindent " auto indentation
set smarttab " better blank insertion
set nojoinspaces " single space after punctuation
" ====================== UI ======================
syntax enable " syntax highlighting
set number " display line numbers
set display+=lastline " do not truncate long last line
set scrolloff=5 " number of lines to show above/below cursor
set showcmd " show command in the last line of the screen
set laststatus=2 " always show status line
set colorcolumn=+1 " highlight textwidth column
" ================== Behaviour ===================
let mapleader=',' " more accessible leader key
set backspace=indent,eol,start " allow backspacing in Insert mode
set listchars=tab:>\ ,trail:-,nbsp:+ " characters used in list mode
set splitbelow " open horizontal split below
set splitright " open vertical split to the right
set wildmenu " enhanced command completion
set wildmode=list:longest,list:full " 1st Tab completes till longest common string, 2nd opens wildmenu
set incsearch " highlight searched pattern while typing
set hlsearch " keep matches from previous search highlighted
set smartcase " make search case sensitive when pattern contains uppercase chars
set ignorecase " required by smartcase
set autoread " re-read files changed outside of Vim
set ttimeout " wait for character after Esc
set ttimeoutlen=50 " shorten wait for key sequence after Esc
set mouse= " disable mouse support
set autowrite " automatically write buffer on commands like :next
packadd! matchit " improve % command
" start new undo sequence after a newline or C-U in insert mode
inoremap
inoremap
" use Space to toggle/create folds
nnoremap
vnoremap
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
Included patches: 1-2269
Modified by [email protected]
go version go1.14.2 linux/amd64
go env Output:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/acotten/.cache/go-build"
GOENV="/home/acotten/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/acotten/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/acotten/go/src/myproject/go.mod"
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-build724078314=/tmp/go-build -gno-record-gcc-switches"
gopls version Output:
golang.org/x/tools/gopls 0.4.1
golang.org/x/tools/[email protected] h1:0e3BPxGV4B3cd0zdMuccwW72SgmHp92lAjOyxX/ScAw=
Thank you for reporting. I've also seen this and will get a PR up this weekend to resolve it. Would you be wiling to help test it since there isn't a reliable reproduction path?
Sure, happy to help however I can, I usually run from master anyway.
https://github.com/fatih/vim-go/pull/2892 is ready for you to try. I'll be using it over the next week, too, to make sure it resolves the problem as expected.
So far so good @bhcleek
Most helpful comment
https://github.com/fatih/vim-go/pull/2892 is ready for you to try. I'll be using it over the next week, too, to make sure it resolves the problem as expected.