Goldsmith
Go development environment for Neovim utilizing the builtin LSP and other features and plugins specific to Neovim.
Features
view all screencasts here
- codelens support screencast
- flag and update out-of-date dependencies in your current Go module screencast
- automatically run goimports on save screencast
- auto-highlight the current symbol under the cursor throughout the current buffer screencast
- treesitter navigation utilizing the nvim-treesitter-textobjects plugin
- treesitter text objects utilizing the nvim-treesitter-textobjects plugin
- convert JSON to Go structs directly in your code, or paste from outside the editor screencast
- view Go documentation using the :GoDoc command and Go help with :GoHelp screencast
- context sensitive help with either :GoContextHelp or via a keybinding
- manually update imports using the :GoImports command screencast
- use :checkhealth to see if your Goldsmith setup should work correctly screencast
- format your code on demand using :GoFormat or have Goldsmith automatically format your code on save screencast
- integration with Telescope for a number of file picking needs screencast
- run extra linters and/or formatters using null-ls: currently has support for golines, gofmt, gofumpt, revive, golangci-lint, and staticcheck
- see the source of the diagnostic when running extra linters
- Goldsmith can completely configure everything for you, if you want (see the Configurations wiki for more)
- generate test stubs automatically using
gotests
screencast - create implementation stubs for your interfaces using :GoImpl screencast
- :GoFillStruct utilizes LSP to fill the current struct
- switch to the 'alternate' file quickly screencast
- struct tag editing: add / remove / update struct tags and options screencast
- use common go subcommands from within Neovim with: :GoBuild, :GoInstall, :GoGet, :GoRun, and others screencast
- coverage support: annotate the current buffer and store coverage data for all files affected screencast
- statusline integration: see the status of running jobs and of coverage data for the current buffer screencast
- edit the go.mod file from within Neovim with: :GoModTidy, :GoModCheck, :GoModRetract, :GoModReplace, and others
- use the excellent builtin testing framework to run individual tests, package tests, or all your tests
- all the great Neovim LSP functions are available as Vim commands
- most commands are completely asynchronous
- support for nvim-lsp-installer
Installation
Install using your favorite plugin manager.
If you use vim-plug:
Plug 'WhoIsSethDaniel/goldsmith.nvim'
Or if you use Vim 8 style packages:
cd <plugin dir>
git clone https://github.com/WhoIsSethDaniel/goldsmith.nvim
Quickstart
-
Install Go.
-
Install Goldsmith, lspconfig, treesitter and null-ls.
-
Install required external programs:
nvim +GoInstallBinaries
You may receive some warnings from Goldsmith about missing programs. These can be ignored since you are now installing those programs.
After the installation completes (usually within a minute or so) run
:checkhealth goldsmith
Make certain everything looks okay.
-
Restart Neovim.
-
Start editing Go code.
-
Currently you are running with Goldsmith defaults. So take a look at the documentation and tweak your configuration.
Configuration
See the configuration page on the wiki for examples demonstrating how to configure Goldsmith.
Also see the Goldsmith :help documentation or
after installing Goldsmith by using :h goldsmith
.
Minimal Requirements
- Neovim >= 0.5.0
- go >= 1.15
- gopls >= 0.6.6[*]
- nvim-lspconfig
These 'minimal' requirements are not hard-and-fast. They are simply the minimal versions that the author has been able to test with. Goldsmith may work just fine with older versions of Go, gopls, etc.... Neovim, however, must be at least 0.5.0 and nvim-lspconfig is also a hard requirement.
Goldsmith will not work with Vim or versions of Neovim prior to 0.5.0.
Run :checkhealth goldsmith
after installing to see what is required and what needs to be done to meet the minimal
requirements.
[*] Goldsmith depends on package completion provided by gopls. Prior to 0.6.6 this did not exist. If you use a gopls earlier than 0.6.6 it means package completion will not work for those commands that require it.
Reporting Problems / Asking Questions
Goldsmith is very new. It works for the author, but does it work for you? If not, please consider asking a question or reporting a problem.