snippet /^import/ "Import declaration" r import ( "${1:package}" ) endsnippet snippet struct "Struct declaration" b type ${1:Struct} struct { ${0:${VISUAL}} } endsnippet snippet interface "Interface declaration" b type ${1:Interface} interface { ${0:${VISUAL}} } endsnippet snippet if "If statement" b if ${1:condition}${1/(.+)/ /}{ ${0:${VISUAL}} } endsnippet snippet switch "Switch statement" b switch ${1:expression}${1/(.+)/ /}{ case$0 } endsnippet snippet /^main/ "Main function" r func main() { ${0:${VISUAL}} } endsnippet snippet /^meth/ "Method" r func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { ${0:${VISUAL}} } endsnippet snippet func "Function" b func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { ${0:${VISUAL}} } endsnippet snippet map "Map type" b map[${1:keytype}]${2:valtype} endsnippet snippet : "Variable declaration :=" b ${1:name} := ${0:value} endsnippet snippet var "Variable declaration" b var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} endsnippet snippet vars "Variables declaration" b var ( ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } ) endsnippet snippet json "JSON field" \`json:"${1:displayName}"\` endsnippet snippet err "Basic error handling" b if err != nil { log.${1:Fatal}(err) } endsnippet