-- nvim/.config/nvim/after/ftplugin/go.lua
vim.bo.expandtab = false
vim.bo.tabstop = 4
vim.bo.shiftwidth = 4
vim.bo.softtabstop = 4
-- Use go.nvim-style commands without the plugin.
vim.api.nvim_buf_create_user_command(0, "GoTest", function(args)
local cmd = { "go", "test", "-race", "-count=1" }
if args.args ~= "" then
table.insert(cmd, "-run")
table.insert(cmd, args.args)
end
table.insert(cmd, "./...")
vim.cmd("!" .. table.concat(cmd, " "))
end, { nargs = "?", desc = "go test ./..." })
vim.api.nvim_buf_create_user_command(0, "GoMod", function()
vim.cmd("!go mod tidy")
end, { desc = "go mod tidy" })
vim.opt_local.formatoptions:remove("o")