加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

SublimeText golang snippets

发布时间:2020-12-16 18:21:18 所属栏目:大数据 来源:网络整理
导读:form: https://github.com/Microsoft/vscode-go "snippets": [], "default_snippets": [{"match": {"global": false,"pkgname": ""},"snippets": [{"text": "package ${default_pkgname}","title": "","value": "package ${default_pkgname}nn$1n"}]},{"m

form: https://github.com/Microsoft/vscode-go

"snippets": [],

"default_snippets": [
	{
		"match": {"global": false,"pkgname": ""},"snippets": [
			{"text": "package ${default_pkgname}","title": "","value": "package ${default_pkgname}nn$1n"}
		]
	},{
		"match": {"global": true,"pkgname": "^main$"},"snippets": [
			{"text": "func main","title": "func main {...}","value": "func main() {nt$0n}n"}
		]
	},"pkgname": "."},"snippets": [
			{"text": "import","title": "import (...)","value": "import (nt"$1"n)"},{"text": "func","title": "func {...}","value": "func ${1:name}($2)$3 {nt$0n}"},{"text": "var","title": "var (...)","value": "var (nt$1n)"},{"text": "const","title": "const (...)","value": "const (nt$1n)"},{"text": "init","title": "func init()","value": "func init() {nt$1n}"},{
				"text": "func http handler","title": "func(rw,req)","value": "func ${1:name}(rw http.ResponseWriter,req *http.Request) {nt$0n}"
			}
		]
	},"pkgname": ".","has_types": true},"snippets": [
			{
				"text": "func (*${typename})","title": "func (...) {...}","value": "func (${1:${typename_abbr}} ${2:*}${typename}) ${3:name}($4)$5 {nt$0n}"
			},{ "text": "test function","title": "tf","value": "func Test$1(t *testing.T) {nt$0n}"
				},{ "text": "benchmark function","title": "bf","value": "func Benchmark$1(b *testing.B) {ntfor ${2:i} := 0; ${2:i} < b.N; ${2:i}++ {ntt$0nt}n}"
				},]
	},{
		"match": {"local": true},"snippets": [
			{"text": "func","title": "func{...}()","value": "func($1) {nt$0n}($2)"},"title": "var [name] [type]","value": "var ${1:name} ${2:type}"},{ "text": "switch statement","title": "switch","value": "switch ${1:expression} {ncase ${2:condition}:nt$0n}"
			},{ "text": "case clause","title": "cs","value": "case ${1:condition}:$0"
				},{ "text": "for statement","title": "for","value": "for ${1:index} := 0; $1 < ${2:count}; $1${3:++} {nt$0n}"
				},{ "text": "for range statement","title": "forr","value": "for ${1:var} := range ${2:var} {nt$0n}"
				},{ "text": "channel declaration","title": "ch","value": "chan ${1:type}"
				},{ "text": "map declaration","title": "map","value": "map[${1:type}]${2:type}"
				},{ "text": "empty interface","title": "in","value": "interface{}"
				},{ "text": "if statement","title": "if","value": "if ${1:condition} {nt$0n}"
				},{ "text": "else branch","title": "el","value": "else {nt$0n}"
				},{ "text": "if else statement","title": "ie","value": "if ${1:condition} {nt$2n} else {nt$0n}"
				},{ "text": "if err != nil","title": "iferr","value": "if err != nil {nt${1:return}n}"
				},{ "text": "make(...)","title": "make","value": "make(${1:type},${2:0})"
				},{ "text": "new(...)","title": "new","value": "new(${1:type})"
				},{ "text": "panic(...)","title": "pn","value": "panic("$0")"
				},{ "text": "goroutine anonymous function","title": "go","value": "go func($1) {nt$2n}($0)"
				},{ "text": "goroutine function","title": "gf","value": "go ${1:func}($0)"
				},{ "text": "defer statement","title": "df","value": "defer ${1:func}($0)"
				},]
	}
],

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读