Skip to content

Instantly share code, notes, and snippets.

@codeliger
Last active August 23, 2019 19:13
Show Gist options
  • Save codeliger/ee6b9b6095497a1fe72e3237e0ac1c63 to your computer and use it in GitHub Desktop.
Save codeliger/ee6b9b6095497a1fe72e3237e0ac1c63 to your computer and use it in GitHub Desktop.
go user snippets
{
"For Loop": {
"prefix": "for",
"body": [
"for ${1:i} := ${2:0}; ${1:i} ${3:<} ${4:INTEGER}; ${1:i}${5:++} {",
"\t$0",
"}"
],
"description": "Create a standard for loop"
},
"For Loop Range": {
"prefix": "range",
"body": [
"for ${1:_},${2:i} := range $3 {",
"\t$0",
"}"
],
"description": "Create a standard for loop"
},
"Error": {
"prefix": "error",
"body": [
"if err != nil {",
" l.${1:Fatal}(\"$0\", zap.Error(err))",
"}"
],
"description": "Logs an error message with zap",
},
"single Variable Call": {
"prefix": "1",
"body": [
"${1:err} := ${2:lib.method}($0)",
],
"description": "A value return type function call",
},
"Two Variable Call": {
"prefix": "2",
"body": [
"${1:var}, err := ${2:lib}.${3:method}($0)",
],
"description": "A value, err return type function call",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment