fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
15.96k stars 1.45k forks source link

Readonly mode after changes (usually fun/interface signature) in any go-file #3368

Closed ep4sh closed 2 years ago

ep4sh commented 2 years ago

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

Save any file after changes, for instance - changing an interface signature or any other changes which related to the separate func call.

What did you expect to happen?

Files has been saved

What happened instead?

Vim goes to read only mode and tells me to use :w! to save the file. Only vim exit helps, until I will change another signature.

E45: 'readonly' option is set (add ! to override)

Configuration (MUST fill this out):

vim-go version:

v1.25-300-g05f97b7

vimrc you used to reproduce:

vimrc ```vim call plug#begin('~/.vim/plugged') Plug 'preservim/nerdtree' Plug 'arcticicestudio/nord-vim' Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' } Plug 'flazz/vim-colorschemes' Plug 'tweekmonster/gofmt.vim' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'mbbill/undotree' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' } Plug 'fatih/vim-go' Plug 'vim-airline/vim-airline' Plug 'rust-lang/rust.vim' Plug 'hashivim/vim-terraform' Plug 'vim-scripts/groovy.vim' Plug 'ollykel/v-vim' call plug#end() ```

Vim version (first three lines from :version):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 13 2021 05:04:57) macOS version - x86_64 Included patches: 1-2671, 3402, 3409, 3428, 3489

Go version (go version):

go version go1.17.6 darwin/amd64

Go environment

go env Output:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/pradchenko/Library/Caches/go-build"
GOENV="/Users/pradchenko/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/pradchenko/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/pradchenko/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.17.6/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.17.6/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/pradchenko/wallarm/devops/repolite2/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0s/fs531rs954j07dx63_0rq83h0000gn/T/go-build3195476205=/tmp/go-build -gno-record-gcc-switches -fno-common"

gopls version

gopls version Output:

golang.org/x/tools/gopls v0.8.0
    golang.org/x/tools/gopls@v0.8.0 h1:a71KO95TfIvCCMQJrZBSQIGQ9lkc0kWL+dSlEdZd7HI=

vim-go configuration:

vim-go configuration
g:go_auto_type_info = 1
g:go_highlight_operators = 1
g:go_highlight_extra_types = 1
g:go_highlight_variable_declarations = 1
g:go_highlight_function_calls = 1
g:go_metalinter_deadline = '5s'
g:go_highlight_fields = 1
g:go_highlight_generate_tags = 1
g:go_metalinter_autosave_enabled = ['vet', 'golint']
g:go_def_mode = 'gopls'
g:go_auto_sameids = 1
g:go_info_mode = 'gopls'
g:go_highlight_function_parameters = 1
g:go_highlight_format_strings = 1
g:go_highlight_structs = 1
g:go_highlight_functions = 1
g:go_highlight_build_constraints = 1
g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
g:go_loaded_install = 1
g:go_metalinter_autosave = 1
g:go_highlight_types = 1
g:go_fmt_command = 'goimports'
g:go_jump_to_error = 1
g:go_highlight_methods = 1
g:go_loaded_gosnippets = 1

filetype detection configuration:

filetype detection
filetype detection:ON  plugin:ON  indent:ON

Please let me know if any additional details are required, appreciate your time and your help. Thank you in advance, Pasha

bhcleek commented 2 years ago

Vim-go does not set readonly on any of the Go buffers.

Can you duplicate this behavior without any other plugins loaded?

ep4sh commented 2 years ago

Thank you, @bhcleek , apologize for a late response, I was managed to figure out the problem plugin (nerd-tree) by switching off one-by-one other plugins.

JFYI - the issue occurs when static check is failed for .go file