Merge pull request #533 from 1ny/master

HTTP handler and Error handling snippets in Go
This commit is contained in:
Louis Pilfold 2015-03-06 23:06:34 +00:00
commit cf5801918a

View File

@ -111,6 +111,12 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
}
endsnippet
snippet funch "HTTP handler" b
func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
${0:${VISUAL}}
}
endsnippet
# types and variables
snippet map "Map type" b
map[${1:keytype}]${2:valtype}
@ -135,3 +141,10 @@ snippet json "JSON field"
endsnippet
# vim:ft=snippets:
# error handling
snippet err "Basic error handling" b
if err != nil {
log.${1:Fatal}(err)
}
endsnippet