feat: allow gotests -template_dir argument customization

This commit is contained in:
brotifypacha 2024-02-17 01:19:44 +03:00
parent 03cabf675c
commit 5e35bc3fdb
3 changed files with 12 additions and 0 deletions

View file

@ -39,6 +39,9 @@ require("gopher").setup {
impl = "impl",
iferr = "iferr",
},
gotests = {
template_dir = "" -- customize gotests -template_dir argument
}
}
```

View file

@ -21,6 +21,10 @@ local M = {
iferr = "iferr",
dlv = "dlv",
},
gotests_args = {
---override gotests templates
template_dir = "",
},
},
}

View file

@ -22,6 +22,11 @@ end
---@param args table
local function add_test(args)
local c = require("gopher.config").config.gotests
if c.template_dir ~= "" then
table.insert(args, "-template_dir")
table.insert(args, c.template_dir)
end
local fpath = vim.fn.expand "%" ---@diagnostic disable-line: missing-parameter
table.insert(args, "-w")
table.insert(args, fpath)