ray-x / go.nvim

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

how to use goimports-reviser instead of goimports #409

Open roychoo opened 11 months ago

roychoo commented 11 months ago

Hi, wish to use https://github.com/incu6us/goimports-reviser instead of goimports, how could i configure it? it tried

goimports = goimports-reviser

but it is not working

ray-x commented 11 months ago

I have not used goimports-reviser. Are there errors? Also are goimports and goimports-reviser compatible?

mortymacs commented 9 months ago

I also have similar problem.

I just put this logic inside the formatter plugin, but it would be great if we can support it inside your plugin:

    go = {
      function()
        return {
          exe = "goimports-reviser",
          args = {
            "-output",
            "stdout",
            "-rm-unused",
            util.escape_path(util.get_current_buffer_file_path()),
          },
          stdin = true,
        }
      end,
      require("formatter.filetypes.go").gofumpt,
      require("formatter.filetypes.go").golines,
    },