Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
snippet for error loop, put it somewhere beneath ~/.config/sublime-text-3/Packages/User
<snippet>
<content><![CDATA[
var (
// define the variables here that are shared along the steps
// most variables should only by defined by the type here
// and are assigned inside the steps
err error
${1:}
)
steps:
for jump := 1; err == nil; jump++ {
switch jump - 1 {
default:
break steps
// count a number up for each following step
case 0:
// assign to err or vars from above
// jump to a step by assigning jump to the step number
${2:}
}
}
// use err here
${3:}
]]></content>
<tabTrigger>errloop</tabTrigger>
<scope>source.go</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment