[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

refactor(installer): install gotests@develop by default (#95)

* refactor(installer): automatically install gotests@develop

* docs: update

authored by olexsmir.xyz and committed by GitHub c5cc5080 55bc5787

-1
README.md
··· 57 57 -- path to a directory containing custom test code templates 58 58 template_dir = nil, 59 59 -- switch table tests from using slice to map (with test name for the key) 60 - -- works only with gotests installed from develop branch 61 60 named = false, 62 61 }, 63 62 gotag = {
+4 -19
doc/gopher.nvim.txt
··· 22 22 `gopher.setup`({user_config}) 23 23 Setup function. This method simply merges default config with opts table. 24 24 You can read more about configuration at |gopher.nvim-config| 25 - Calling this function is optional, if you ok with default settings. Look |gopher.nvim.config-defaults| 25 + Calling this function is optional, if you ok with default settings. 26 + See |gopher.nvim.config-defaults| 26 27 27 28 Usage ~ 28 29 `require("gopher").setup {}` (replace `{}` with your `config` table) ··· 35 36 Gopher.nvim implements most of its features using third-party tools. 36 37 To install these tools, you can run `:GoInstallDeps` command 37 38 or call `require("gopher").install_deps()` if you want to use lua api. 39 + By default dependencies will be installed asynchronously, to install them synchronously pass `{sync = true}` as an argument. 38 40 39 41 40 42 ============================================================================== ··· 77 79 ---@type string|nil 78 80 template_dir = nil, 79 81 -- switch table tests from using slice to map (with test name for the key) 80 - -- works only with gotests installed from develop branch 81 82 named = false, 82 83 }, 83 84 ---@class gopher.ConfigGoTag ··· 208 209 *gopher.nvim-gotests-named* 209 210 210 211 You can enable named tests in the config if you prefer using named tests. 211 - But you must install `gotests@develop` because the stable version doesn't support this feature. 212 - 213 - >lua 214 - -- simply run go get in your shell: 215 - go install github.com/cweill/gotests/...@develop 216 - 217 - -- if you want to install it within neovim, you can use one of this: 218 - -- if you choose to install gotests this way i reocmmend adding it to your `build` section in your |lazy.nvim| 219 - 220 - vim.fn.jobstart("go install github.com/cweill/gotests/...@develop") 212 + See |gopher.nvim-config|. 221 213 222 - -- or if you want to use mason: 223 - require("mason-tool-installer").setup { 224 - ensure_installed = { 225 - { "gotests", version = "develop" }, 226 - } 227 - } 228 - < 229 214 230 215 ============================================================================== 231 216 ------------------------------------------------------------------------------
-1
lua/gopher/config.lua
··· 55 55 ---@type string|nil 56 56 template_dir = nil, 57 57 -- switch table tests from using slice to map (with test name for the key) 58 - -- works only with gotests installed from develop branch 59 58 named = false, 60 59 }, 61 60 ---@class gopher.ConfigGoTag
+1 -18
lua/gopher/gotests.lua
··· 19 19 ---@tag gopher.nvim-gotests-named 20 20 ---@text 21 21 --- You can enable named tests in the config if you prefer using named tests. 22 - --- But you must install `gotests@develop` because the stable version doesn't support this feature. 23 - --- 24 - --- >lua 25 - --- -- simply run go get in your shell: 26 - --- go install github.com/cweill/gotests/...@develop 27 - --- 28 - --- -- if you want to install it within neovim, you can use one of this: 29 - --- -- if you choose to install gotests this way i reocmmend adding it to your `build` section in your |lazy.nvim| 30 - --- 31 - --- vim.fn.jobstart("go install github.com/cweill/gotests/...@develop") 32 - --- 33 - --- -- or if you want to use mason: 34 - --- require("mason-tool-installer").setup { 35 - --- ensure_installed = { 36 - --- { "gotests", version = "develop" }, 37 - --- } 38 - --- } 39 - --- < 22 + --- See |gopher.nvim-config|. 40 23 41 24 local c = require "gopher.config" 42 25 local ts_utils = require "gopher._utils.ts"
+3 -1
lua/gopher/init.lua
··· 19 19 ---@tag gopher.nvim-setup 20 20 ---@text Setup function. This method simply merges default config with opts table. 21 21 --- You can read more about configuration at |gopher.nvim-config| 22 - --- Calling this function is optional, if you ok with default settings. Look |gopher.nvim.config-defaults| 22 + --- Calling this function is optional, if you ok with default settings. 23 + --- See |gopher.nvim.config-defaults| 23 24 --- 24 25 ---@usage `require("gopher").setup {}` (replace `{}` with your `config` table) 25 26 ---@param user_config gopher.Config ··· 34 35 ---@text Gopher.nvim implements most of its features using third-party tools. 35 36 --- To install these tools, you can run `:GoInstallDeps` command 36 37 --- or call `require("gopher").install_deps()` if you want to use lua api. 38 + --- By default dependencies will be installed asynchronously, to install them synchronously pass `{sync = true}` as an argument. 37 39 gopher.install_deps = require("gopher.installer").install_deps 38 40 39 41 gopher.impl = require("gopher.impl").impl
+5 -6
lua/gopher/installer.lua
··· 5 5 local installer = {} 6 6 7 7 local urls = { 8 - gomodifytags = "github.com/fatih/gomodifytags", 9 - impl = "github.com/josharian/impl", 10 - gotests = "github.com/cweill/gotests/...", 11 - iferr = "github.com/koron/iferr", 8 + gomodifytags = "github.com/fatih/gomodifytags@latest", 9 + impl = "github.com/josharian/impl@latest", 10 + gotests = "github.com/cweill/gotests/...@develop", 11 + iferr = "github.com/koron/iferr@latest", 12 12 } 13 13 14 14 ---@param opt vim.SystemCompleted ··· 40 40 ---@param opts? {sync:boolean} 41 41 function installer.install_deps(opts) 42 42 opts = opts or {} 43 - for pkg, _ in pairs(urls) do 44 - local url = urls[pkg] .. "@latest" 43 + for url, _ in pairs(urls) do 45 44 if opts.sync then 46 45 install_sync(url) 47 46 else