mirror of
https://github.com/pnx/dotfiles
synced 2026-07-04 07:13:40 +02:00
nvim/snippets/go.lua: add snippet for if error case
This commit is contained in:
parent
846f15666b
commit
c8637d1aee
1 changed files with 6 additions and 0 deletions
|
|
@ -5,6 +5,12 @@ local t = ls.text_node
|
||||||
local i = ls.insert_node
|
local i = ls.insert_node
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
s("iferr", {
|
||||||
|
t({"if err != nil {", ""}),
|
||||||
|
t({"\treturn err", ""}),
|
||||||
|
t({"}"})
|
||||||
|
}),
|
||||||
|
|
||||||
-- Test function
|
-- Test function
|
||||||
s("tst", {
|
s("tst", {
|
||||||
t("func Test"), i(1, "Module"), t("_"), i(2, "Name"), t({"(t *testing.T) {", ""}),
|
t("func Test"), i(1, "Module"), t("_"), i(2, "Name"), t({"(t *testing.T) {", ""}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue