38 lines
504 B
Lua
38 lines
504 B
Lua
---@diagnostic disable: unused-local, undefined-global
|
|
|
|
return {
|
|
-- s("testgo", {
|
|
-- t"Hello go snippet"
|
|
-- })
|
|
|
|
-- defer
|
|
s("def", fmt([[
|
|
defer func(){{
|
|
{}
|
|
}}()
|
|
|
|
]],
|
|
{
|
|
i(0)
|
|
})
|
|
|
|
),
|
|
|
|
-- defer and handle error from some call
|
|
s({trig = "defe", dscr = "defer with error"}, fmt([[
|
|
defer func(){{
|
|
err := {}
|
|
if err != nil {{
|
|
{}
|
|
}}
|
|
}}()
|
|
|
|
]],
|
|
{
|
|
i(1),
|
|
i(0)
|
|
})
|
|
|
|
),
|
|
}
|