Description
Suddenly, my auto imports stopped working for new go projects. For existing projects, it appears to be working still. I have searched for this issue on the internet and in the troubleshooting but couldn't get a clear answer. The only thing I recently did (in this context) was updating to go version 1.21.6
What did you do? (required: The issue will be closed when not provided)
- Re-installed Go 1.21.6
- Re-installed Vim 9.0
- Re-installed go.vim
- Ran :GoInstallBinaries
- Tried several package managers (Pathogen and VIM packages) to install go.vim
Steps:
- mkdir test
- cd test
- go mod init main
- vim main.go
- delete 'import "fmt"' line
- save file
What did you expect to happen?
I expected vim.go to add 'import "fmt"' when saving the file.
What happened instead?
It didn't add the import line. It did however remove the the newline that was present (so the formatter worked)
Configuration (MUST fill this out):
vim-go version:
5bed70d - (3 days ago) Merge pull request #3628 from bhcleek/revive/unpin - Billie Cleek (HEAD -> master, origin/master, origin/HEAD)
vimrc
you used to reproduce:
syntax on
execute pathogen#infect()
filetype plugin indent on
let mapleader = ","
"Go:
au FileType go nmap r :GoRun
au FileType go nmap b :GoBuild
au FileType go nmap t :GoTest
au FileType go nmap d :GoDoc
au FileType go nmap cw :GoRename
Vim version (first three lines from :version
):
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 12 2023 01:15:20)
macOS version - x86_64
Included patches: 1-2018
Go version (go version
):
go version go1.21.6 darwin/amd64
Go environment
go env
Output:
GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/Users/user/Library/Caches/go-build' GOENV='/Users/user/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/user/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/user/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64' GOVCS='' GOVERSION='go1.21.6' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/Users/user/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/1c/tcpf2y_118x2_f1jc42zh7lc0000gq/T/go-build158379205=/tmp/go-build -gno-record-gcc-switches -fno-common'