ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
2.06k stars 123 forks source link

failed to save go file #370

Closed ttbug closed 1 year ago

ttbug commented 1 year ago

local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {}) vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.go", callback = function() require('go.format').goimport() end, group = format_sync_grp, })

when update to commit c61f9371cdaaec40cccf0783ff968bee83df5bda, could not save go file,write command is not working remove goimport config upon or rollback to last commit,format and import on write command works well.

ray-x commented 1 year ago

Most likely you have other format tools hooked into BufWritePre As currently goimport is async by default if you set it to use gopls. Autocommand from other setups may overwrite the buffer.

ttbug commented 1 year ago

Most likely you have other format tools hooked into BufWritePre As currently goimport is async by default if you set it to use gopls. Autocommand from other setups may overwrite the buffer.

I have carefully reviewed my settings and indeed, such an issue existed. After making modifications, the problem has been resolved. Thank you very much.