gotools/snippets/snippets.json

28 lines
749 B
JSON
Raw Normal View History

2021-03-19 02:22:55 +03:00
{
2023-08-06 01:23:45 +03:00
"package line": {
2021-03-19 02:22:55 +03:00
"body": [
"package ${TM_DIRECTORY/.+\\/(.+)$/${1:/downcase}/}",
"",
"$0"
],
"description": "package header",
"prefix": "pkg"
},
2023-08-06 01:23:45 +03:00
"structure constructor": {
2021-03-19 02:22:55 +03:00
"body": [
2021-03-28 03:07:25 +03:00
"// New$1 returns new $1.",
2021-03-19 02:22:55 +03:00
"func New${1:type}(${2}) *$1 {",
"\t$3",
"\treturn &$1{$4}",
"}"
],
"description": "constructor for structure type",
"prefix": "construct"
},
2023-08-06 01:23:45 +03:00
"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"
2021-03-19 02:22:55 +03:00
}
}