Files
dotfiles/nvim/.config/nvim/lua/snippets/go.lua
2026-01-13 00:37:29 +01:00

44 lines
509 B
Lua

return {
s(
"ife",
fmt(
[[
if err != nil {
<>
}
]],
{
i(0),
},
{ delimiters = "<>" }
)
),
s(
"ifse",
fmt(
[[
if <><>err = <>; err != nil {
<>
}
]],
{
i(1),
f(function(args)
local a = args[1][1]
if string.sub(a, -2) == ", " or a == "" then
return ""
elseif string.sub(a, -1) == "," then
return " "
else
return ", "
end
end, { 1 }),
i(2),
i(0),
},
{ delimiters = "<>" }
)
),
}