go.nvim icon indicating copy to clipboard operation
go.nvim copied to clipboard

favoring gopls format over gofumpt with config requesting gofumpt

Open aka-mj opened this issue 1 year ago • 2 comments

I'd like to use gofumpt for formatting over gopls. I have this specified in my config:

require('go').setup({
  gofmt = 'gofumpt',
  lsp_gofumpt = true,
})

But if I run :GoFmt the format looks like gopls and if I run gofumpt -w <file> from the terminal I see changes where made, further believing gopls is used by :GoFmt rather than gofumpt.

Is there any further troubleshooting steps I could take?


go: require("go.health").check()
========================================================================
## Binaries
  - INFO: go installed.
  - INFO: Tool installed: gorename
  - INFO: Tool installed: goimports
  - INFO: Tool installed: go-enum
  - INFO: Tool installed: fillstruct
  - INFO: Tool installed: golangci-lint
  - INFO: Tool installed: govulncheck
  - INFO: Tool installed: golines
  - INFO: Tool installed: gomodifytags
  - INFO: Tool installed: gotestsum
  - INFO: Tool installed: gomvp
  - INFO: Tool installed: mockgen
  - INFO: Tool installed: impl
  - INFO: Tool installed: guru
  - INFO: Tool installed: callgraph
  - INFO: Tool installed: gofumpt
  - INFO: Tool installed: iferr
  - INFO: Tool installed: dlv
  - INFO: Tool installed: json-to-struct
  - INFO: Tool installed: richgo
  - INFO: Tool installed: ginkgo
  - INFO: Tool installed: fillswitch
  - INFO: Tool installed: gopls
  - INFO: Tool installed: gotests
  - INFO: sed installed.
  - INFO: curl installed.
  - OK: All binaries installed

## Go Plugin Check
  - OK: lspconfig: plugin is installed
  - OK: nvim-treesitter: plugin is installed
  - OK: guihua: plugin is installed
  - WARNING: nvim-dap-virtual-text: not installed/loaded
  - OK: telescope: plugin is installed
  - OK: nvim-treesitter-go is installed
  - WARNING: nvim-dap: not installed/loaded
  - WARNING: nvim-dap-ui: not installed/loaded
  - WARNING: Not all plugin installed
  - OK: GOPATH is set
  - OK: GOROOT is set
  - INFO: GOBIN is not set
  - INFO: Not all enviroment variables set

lazy: require("lazy.health").check()
========================================================================
## lazy.nvim
  - OK: Git installed
  - OK: no existing packages found by other package managers
  - OK: packer_compiled.lua not found

man: require("man.health").check()
========================================================================
  - OK: plugin/man.vim not in $VIMRUNTIME
  - OK: autoload/man.vim not in $VIMRUNTIME

mason: require("mason.health").check()
========================================================================
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - OK: Registry `require("mason-registry.index")` is installed.
  - OK: Registry `github.com/mason-org/mason-registry version: 2023-04-14-marine-cub` is installed.
  - OK: **unzip**: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
  - OK: **Go**: `go version go1.20 linux/amd64`
  - OK: **cargo**: `cargo 1.65.0`
  - WARNING: **luarocks**: not available
  - OK: **Ruby**: `ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]`
  - OK: **RubyGem**: `3.1.2`
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `9.3.1`
  - OK: **node**: `v19.5.0`
  - OK: **python3**: `Python 3.8.10`
  - OK: **pip3**: `pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)`
  - OK: **javac**: `javac 17.0.6`
  - OK: **java**: `openjdk version "17.0.6" 2023-01-17`
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.20.3 built on linux-gnu.`
  - OK: **curl**: `curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3`
  - OK: **gzip**: `gzip 1.10`
  - OK: **tar**: `tar (GNU tar) 1.30`
  - WARNING: **pwsh**: not available
  - OK: **bash**: `GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Fri 14 Apr 2023 01:06:51 PM EDT.

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 0
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: tmux-256color

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  - OK: `node` found v19.5.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

## OS Info:
{
  machine = "x86_64",
  release = "5.15.0-58-generic",
  sysname = "Linux",
  version = "#64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023"
}

## Parser/Features         H L F I J
  - c                   ✓ ✓ ✓ ✓ ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - vim                 x ✓ ✓ . ✓
  - zig                 ✓ . ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

## The following errors have been detected:
  - ERROR: vim(highlights): ...9r8m/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:219: query: invalid node type at position 2765 for language vim
    vim(highlights) is concatenated from the following files:
    | [ERROR]:"/home/mjohn/.local/share/nvim/lazy/nvim-treesitter/queries/vim/highlights.scm", failed to load: ...9r8m/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:219: query: invalid node type at position 2765 for language vim

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 3 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - WARNING: Could not load Python 3:
    /usr/bin/python3 does not have the "neovim" module.
    python3.10 not found in search path or not executable.
    python3.9 not found in search path or not executable.
    /usr/bin/python3.8 does not have the "neovim" module.
    python3.7 not found in search path or not executable.
    /usr/bin/python is Python 2.7 and cannot provide Python 3.
    - ADVICE:
      - See :help |provider-python| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim
  - INFO: Executable: Not found

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.
      - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim

## Node.js provider (optional)
  - INFO: Node.js: v19.5.0
  - WARNING: Missing "neovim" npm (or yarn, pnpm) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim
      - Run in shell (if you use pnpm): pnpm install -g neovim
      - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim

## Perl provider (optional)
  - WARNING: "Neovim::Ext" cpan module is not installed
    - ADVICE:
      - See :help |provider-perl| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - ERROR: rg: not found. `live-grep` finder will not function without [BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep) installed.
  - WARNING: fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

## ===== Installed extensions =====

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/mjohn/.local/state/nvim/lsp.log
  - INFO: Log size: 180 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 14
  - OK: Loaded parser for go: ABI version 14
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for vim: ABI version 14
  - OK: Loaded parser for zig: ABI version 14
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for help: ABI version 14
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for vim: ABI version 14

aka-mj avatar Apr 14 '23 14:04 aka-mj

how about set

lsp_gofumpt = false,

ray-x avatar Apr 15 '23 01:04 ray-x

After that change it doesn't change the behavior. I still see my imports formatted via gopls rather than gofumpt.

aka-mj avatar Apr 18 '23 13:04 aka-mj