all repos

gopher.nvim @ c5cc5080fa75e1876fcb4b34c4b00810a53b0d50

Minimalistic plugin for Go development
6 files changed, 13 insertions(+), 46 deletions(-)
refactor(installer): install gotests@develop by default (#95)

* refactor(installer): automatically install gotests@develop

* docs: update
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed by: GitHub noreply@github.com
Committed at: 2025-03-21 00:54:04 +0200
Parent: 55bc578
M README.md

@@ -57,7 +57,6 @@ template = "default",

-- path to a directory containing custom test code templates template_dir = nil, -- switch table tests from using slice to map (with test name for the key) - -- works only with gotests installed from develop branch named = false, }, gotag = {
M doc/gopher.nvim.txt

@@ -22,7 +22,8 @@ *gopher.nvim-setup*

`gopher.setup`({user_config}) Setup function. This method simply merges default config with opts table. You can read more about configuration at |gopher.nvim-config| -Calling this function is optional, if you ok with default settings. Look |gopher.nvim.config-defaults| +Calling this function is optional, if you ok with default settings. +See |gopher.nvim.config-defaults| Usage ~ `require("gopher").setup {}` (replace `{}` with your `config` table)

@@ -35,6 +36,7 @@ `gopher.install_deps`

Gopher.nvim implements most of its features using third-party tools. To install these tools, you can run `:GoInstallDeps` command or call `require("gopher").install_deps()` if you want to use lua api. +By default dependencies will be installed asynchronously, to install them synchronously pass `{sync = true}` as an argument. ==============================================================================

@@ -77,7 +79,6 @@ -- path to a directory containing custom test code templates

---@type string|nil template_dir = nil, -- switch table tests from using slice to map (with test name for the key) - -- works only with gotests installed from develop branch named = false, }, ---@class gopher.ConfigGoTag

@@ -208,24 +209,8 @@ ------------------------------------------------------------------------------

*gopher.nvim-gotests-named* You can enable named tests in the config if you prefer using named tests. -But you must install `gotests@develop` because the stable version doesn't support this feature. - ->lua - -- simply run go get in your shell: - go install github.com/cweill/gotests/...@develop - - -- if you want to install it within neovim, you can use one of this: - -- if you choose to install gotests this way i reocmmend adding it to your `build` section in your |lazy.nvim| - - vim.fn.jobstart("go install github.com/cweill/gotests/...@develop") +See |gopher.nvim-config|. - -- or if you want to use mason: - require("mason-tool-installer").setup { - ensure_installed = { - { "gotests", version = "develop" }, - } - } -< ============================================================================== ------------------------------------------------------------------------------
M lua/gopher/config.lua

@@ -55,7 +55,6 @@ -- path to a directory containing custom test code templates

---@type string|nil template_dir = nil, -- switch table tests from using slice to map (with test name for the key) - -- works only with gotests installed from develop branch named = false, }, ---@class gopher.ConfigGoTag
M lua/gopher/gotests.lua

@@ -19,24 +19,7 @@

---@tag gopher.nvim-gotests-named ---@text --- You can enable named tests in the config if you prefer using named tests. ---- But you must install `gotests@develop` because the stable version doesn't support this feature. ---- ---- >lua ---- -- simply run go get in your shell: ---- go install github.com/cweill/gotests/...@develop ---- ---- -- if you want to install it within neovim, you can use one of this: ---- -- if you choose to install gotests this way i reocmmend adding it to your `build` section in your |lazy.nvim| ---- ---- vim.fn.jobstart("go install github.com/cweill/gotests/...@develop") ---- ---- -- or if you want to use mason: ---- require("mason-tool-installer").setup { ---- ensure_installed = { ---- { "gotests", version = "develop" }, ---- } ---- } ---- < +--- See |gopher.nvim-config|. local c = require "gopher.config" local ts_utils = require "gopher._utils.ts"
M lua/gopher/init.lua

@@ -19,7 +19,8 @@ ---@toc_entry Setup

---@tag gopher.nvim-setup ---@text Setup function. This method simply merges default config with opts table. --- You can read more about configuration at |gopher.nvim-config| ---- Calling this function is optional, if you ok with default settings. Look |gopher.nvim.config-defaults| +--- Calling this function is optional, if you ok with default settings. +--- See |gopher.nvim.config-defaults| --- ---@usage `require("gopher").setup {}` (replace `{}` with your `config` table) ---@param user_config gopher.Config

@@ -34,6 +35,7 @@ ---@tag gopher.nvim-install-deps

---@text Gopher.nvim implements most of its features using third-party tools. --- To install these tools, you can run `:GoInstallDeps` command --- or call `require("gopher").install_deps()` if you want to use lua api. +--- By default dependencies will be installed asynchronously, to install them synchronously pass `{sync = true}` as an argument. gopher.install_deps = require("gopher.installer").install_deps gopher.impl = require("gopher.impl").impl
M lua/gopher/installer.lua

@@ -5,10 +5,10 @@ local log = require "gopher._utils.log"

local installer = {} local urls = { - gomodifytags = "github.com/fatih/gomodifytags", - impl = "github.com/josharian/impl", - gotests = "github.com/cweill/gotests/...", - iferr = "github.com/koron/iferr", + gomodifytags = "github.com/fatih/gomodifytags@latest", + impl = "github.com/josharian/impl@latest", + gotests = "github.com/cweill/gotests/...@develop", + iferr = "github.com/koron/iferr@latest", } ---@param opt vim.SystemCompleted

@@ -40,8 +40,7 @@ ---Install required go deps

---@param opts? {sync:boolean} function installer.install_deps(opts) opts = opts or {} - for pkg, _ in pairs(urls) do - local url = urls[pkg] .. "@latest" + for url, _ in pairs(urls) do if opts.sync then install_sync(url) else