This commit is contained in:
Smirnov Oleksandr 2024-03-01 23:20:51 +02:00
parent 85f4ae9f57
commit df7ad677ba
2 changed files with 18 additions and 12 deletions

View file

@ -6,5 +6,11 @@
"after_each", "after_each",
"before_all", "before_all",
"after_all" "after_all"
],
"workspace.library": [
"/home/olex/.local/share/nvim/lazy/neodev.nvim/types/nightly",
"/usr/share/nvim/runtime/lua",
"/home/olex/code/gopher.nvim/lua",
"${3rd}/luv/library"
] ]
} }

View file

@ -4,7 +4,7 @@
Minimalistic plugin for Go development in Neovim written in Lua. Minimalistic plugin for Go development in Neovim written in Lua.
It's **NOT** an LSP tool, the main goal of this plugin is add go tooling support in Neovim. It's **NOT** an LSP tool, the main goal of this plugin is to add go tooling support in Neovim.
## Install (using [lazy.nvim](https://github.com/folke/lazy.nvim) ## Install (using [lazy.nvim](https://github.com/folke/lazy.nvim)
@ -22,7 +22,7 @@ Pre-dependency:
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
"mfussenegger/nvim-dap", -- (optional) only if you use `gopher.dap` "mfussenegger/nvim-dap", -- (optional) only if you use `gopher.dap`
}, },
-- (optional) update pluign's deps on every update -- (optional) update plugin's deps on every update
build = function() build = function()
vim.cmd.GoInstallDeps() vim.cmd.GoInstallDeps()
end, end,
@ -56,7 +56,7 @@ require("gopher").setup {
>[!IMPORTANT] >[!IMPORTANT]
> >
> For named tests to work you have to install gotests from develop branch. Next code snippets could be placed into build step in Lazy plugin declatation > For named tests to work you have to install gotests from develop branch. Next code snippets could be placed into the build step in the Lazy plugin declaration
```lua ```lua
-- using mason-tool-installer -- using mason-tool-installer
@ -83,7 +83,7 @@ vim.fn.jobstart("go install github.com/cweill/gotests/...@develop")
:GoInstallDeps :GoInstallDeps
``` ```
This will install next tools: This will install the following tools:
- [gomodifytags](https://github.com/fatih/gomodifytags) - [gomodifytags](https://github.com/fatih/gomodifytags)
- [impl](https://github.com/josharian/impl) - [impl](https://github.com/josharian/impl)
@ -123,10 +123,10 @@ This will install next tools:
" Generate one test for a specific function/method(one under cursor) " Generate one test for a specific function/method(one under cursor)
:GoTestAdd :GoTestAdd
" Generate all tests for all functions/methods in current file " Generate all tests for all functions/methods in the current file
:GoTestsAll :GoTestsAll
" Generate tests only for exported functions/methods in current file: " Generate tests only for exported functions/methods in the current file:
:GoTestsExp :GoTestsExp
``` ```
@ -144,10 +144,10 @@ This will install next tools:
```vim ```vim
:GoGet github.com/gorilla/mux :GoGet github.com/gorilla/mux
" Link can have a `http` or `https` prefix. " Link can have an `http` or `https` prefix.
:GoGet https://github.com/lib/pq :GoGet https://github.com/lib/pq
" You can provide more than one package url: " You can provide more than one package url
:GoGet github.com/jackc/pgx/v5 github.com/google/uuid/ :GoGet github.com/jackc/pgx/v5 github.com/google/uuid/
" go mod commands " go mod commands
@ -160,7 +160,7 @@ This will install next tools:
" run go generate in cwd " run go generate in cwd
:GoGenerate :GoGenerate
" run go generate for current file " run go generate for the current file
:GoGenerate % :GoGenerate %
``` ```
</details> </details>
@ -174,7 +174,7 @@ This will install next tools:
```vim ```vim
:GoImpl [receiver] [interface] :GoImpl [receiver] [interface]
" also you can put cursor on the struct and run " also you can put a cursor on the struct and run
:GoImpl [interface] :GoImpl [interface]
``` ```
@ -183,7 +183,7 @@ This will install next tools:
:GoImpl r Read io.Reader :GoImpl r Read io.Reader
:GoImpl Write io.Writer :GoImpl Write io.Writer
" or your can put cursor on the struct and run " or you can put a cursor on the struct and run
:GoImpl io.Reader :GoImpl io.Reader
``` ```
</details> </details>
@ -206,7 +206,7 @@ This will install next tools:
<b>Generate `if err != nil {` via [iferr](https://github.com/koron/iferr)</b> <b>Generate `if err != nil {` via [iferr](https://github.com/koron/iferr)</b>
</summary> </summary>
Set cursor on the line with `err` and execute Set the cursor on the line with `err` and execute
```vim ```vim
:GoIfErr :GoIfErr