-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.json
More file actions
97 lines (92 loc) · 2.45 KB
/
Copy pathgo.json
File metadata and controls
97 lines (92 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
/*
// Place your snippets for Go here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"return":{
"prefix": "re",
"body": "return",
"description": "return content"
},
"for key ,value:":{
"prefix":"for k",
"body": "for key,value:=range {\n\n}",
"description": "for range key,value"
},
"for select range":{
"prefix": "for s",
"body": "for{\n select {\n\n} \n}",
"description": "for select statement"
},
"defer recover":{
"prefix": "defer r",
"body": "defer func() { \nif re := recover(); re != nil {\nlog.Error(\"recover panic : \", re)\n}\n}()",
"description": "defer recover function"
},
"make map":{
"prefix": "make m",
"body": "make(map[interface{}]interface{})",
"description": "make map"
},
"comment":{
"prefix": "comment",
"body": "/*******************\n\n\n\n*********************/",
"description": "user comment"
},
"copyright":{
"prefix": "copyright",
"body": "// Copyright 2016 The Grapes. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.",
"description": "Copyright declare"
},
"if m":{
"prefix": "if m",
"body": "if value,ok:= map[interface{}]interface{};ok{ \r\n }",
"description": "判断map并生成if语句"
},
"if hachha":{
"prefix": "if chan",
"body": "if value ,ok :=range <-chan ;ok{ \r\n }",
"description": ""
},
"signal":{
"prefix": "signal",
"body": [
"sc := make(chan os.Signal, 1)",
"signal.Notify(sc,",
"syscall.SIGINT,",
"syscall.SIGTERM,",
"syscall.SIGQUIT,",
")",
"<-sc"
]
},
"for chan":{
"prefix": "for chan",
"body": [
"for ok,value:=range <- value chan;ok{",
//here to do
"}"
],
"description": "for chan loop"
},
"switch":{
"prefix": "switch e",
"body": "switch e:=e.(type){\n default:\n // error is nil \n case error:\n \\error os non-nil \n return e \n }",
"description": "根据error.(type)来判定错误的处理方式"
},
"package mo":{
"prefix": "package mo",
"body": "",
"description": ""
}
}