gotools/snippets/snippets.json
2023-08-06 01:29:52 +03:00

27 lines
749 B
JSON

{
"package line": {
"body": [
"package ${TM_DIRECTORY/.+\\/(.+)$/${1:/downcase}/}",
"",
"$0"
],
"description": "package header",
"prefix": "pkg"
},
"structure constructor": {
"body": [
"// New$1 returns new $1.",
"func New${1:type}(${2}) *$1 {",
"\t$3",
"\treturn &$1{$4}",
"}"
],
"description": "constructor for structure type",
"prefix": "construct"
},
"if err := ...; err != nil": {
"prefix": "iferr",
"body": "if err := ${1}; err != nil {\n\t${2:return ${3:nil, }${4:err}}\n}",
"description": "Snippet for if err := ...; err != nil"
}
}