Our great sponsors
vim-go | goimports | |
---|---|---|
25 | 46 | |
15,811 | 7,181 | |
- | 1.1% | |
8.3 | 9.9 | |
10 days ago | 7 days ago | |
Vim Script | Go | |
GNU General Public License v3.0 or later | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
vim-go
-
nvim when I open an empty file from go
There are a handful of really good go plugins that take care of this for you, such as https://github.com/ray-x/go.nvim or https://github.com/fatih/vim-go
-
What's the most commonly used IDE for golang development ?
With vim-go and snippets, neovim has almost the same functionality as GoLand
- Is there any way to autocomplete language functions? For example, show things like fmt.Printf or fmt.Println when writing fmt.Print and pressing the autocomplete key.
-
Which editor do you use for your Go coding?
Neovim with its lsp integration. Yes, my configuration breaks whenever neovim is upgraded (it is < v1 after all). But usually I wait a little while, and then update plugins and I’m good to ‘go’. One very very good plug-in is https://github.com/fatih/vim-go. The wiki page has a suggested vimrc, which works very well to integrate things like identifier highlighting, and references.
with this wonderful plugin: https://github.com/fatih/vim-go
- What's your Golang IDE?
-
Anyone write Go full time using vim?
At first Ihad struggled with some common "IDE" tasks. But then I discovered vim-go and realized that it could do pretty much everything that I need and even more.
-
Share your must-know Go development tips
I use vim as an editor, and I think that vim-go (https://github.com/fatih/vim-go) is a huge help, if you use the "gd" shortcut to take you to where a variable, type or function is defined, and the ctrl-T shortcut to take you back. Use goimports (https://pkg.go.dev/golang.org/x/tools/cmd/goimports) as the vim-go code formatter. This will keep imports up-to-date. There are some other vim-go features that may be helpful. You can have it highlight syntax errors, for example. Not every feature is helpful to every programmer, however.
-
vim-rust go-to-definition doesn't work with standard library features
Maybe there's a reason why this isn't possible, but if I compare this work-flow with something like https://github.com/fatih/vim-go I can use go-to-definition for everything (whether it be a third-party package or a standard library feature such as fmt.Printf).
goimports
-
How to find all methods which return struct "Foo" (vscode or cli)
Just a guess, but it might be somewhere in gopls https://github.com/golang/tools/tree/master/gopls/doc On this page https://langserver.org/ it says it should support "finding references"
- GitHub - orijtech/structslop: structslop is a static analyzer for Go that recommends struct field rearrangements to provide for maximum space/allocation efficiency.
-
betteralign - structs field alignment static analyzer for Go
For more gopls settings, you can see files in this folder: https://github.com/golang/tools/tree/master/gopls/doc
-
Linter for explicit hint to interface which gets implemented.
But finding which interface is satisfied by a type is trivial anyways through gopls which integrates conveniently into any LSP supporting IDE (such as VSCode and Goland).
-
LMDE5 + VSCodium setup issues
Error loading workspace: gopls was not able to find modules in your workspace. When outside of GOPATH, gopls needs to know which modules you are working on. You can fix this by opening your workspace to a folder inside a Go module, or by using a go.work file to specify multiple modules. See the documentation for more information on setting up your workspace: https://github.com/golang/tools/blob/master/gopls/doc/workspace.md.
-
How to use AWS SAM with Go in Visual Studio Code
The ResponseEvent struct. The reason for this is that the IDE has set the GOPATH to the root of the project. Therefor the imports are not correct. By using Workspace Folders you can change this behavior so that each folder has it’s own scope.
-
Is there any way to autocomplete language functions? For example, show things like fmt.Printf or fmt.Println when writing fmt.Print and pressing the autocomplete key.
Here are a few resources to get you started: 1. https://github.com/neovim/nvim-lspconfig 1. https://github.com/golang/tools/tree/master/gopls 1. https://github.com/williamboman/nvim-lsp-installer
-
Using multiple repositories in your CI builds
Like with the previous post, we're going to use djinn-ci/imgsrv as an example of using multiple sources in a build manifest. If we look at the top of the manifest file, we will see that it requires three repositories to build. These are, the source code for djinn-ci/imgsrv itself, golang/tools, and valyala/quicktemplate, defined like so,
-
Go Linux/Debian users which is the apt command to install Go via terminal?
Other useful solutions: https://github.com/golang/tools/tree/master/cmd/getgo https://go.dev/doc/manage-install
-
LSP codelens and inlayhints
I was reading about some of the gopls settings and ended up enabling a few, especially about codelens and inlayhints, only to come to the realization that more work is needed to make them work.
What are some alternatives?
coc-go - Go language server extension using gopls for coc.nvim.
coc.nvim - Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
go.nvim - A feature-rich Go development plugin, leveraging gopls, treesitter AST, Dap, and various Go tools to enhance the dev experience.
gofumpt - A stricter gofmt
Go for Visual Studio Code
YouCompleteMe - A code-completion engine for Vim
nvim-lspconfig - Quickstart configs for Nvim LSP
goreturns - A gofmt/goimports-like tool for Go programmers that fills in Go return statements with zero values to match the func return types
GoLint - [mirror] This is a linter for Go source code. (deprecated)
gocode - An autocompletion daemon for the Go programming language
ale - Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
kotlin-vim - Kotlin plugin for Vim. Featuring: syntax highlighting, basic indentation, Syntastic support