Skip to content

Instantly share code, notes, and snippets.

@tylerstillwater
Created December 20, 2014 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerstillwater/e4a3312239496de72007 to your computer and use it in GitHub Desktop.
Save tylerstillwater/e4a3312239496de72007 to your computer and use it in GitHub Desktop.
Sublime Text Settings for Golang
{
"snippets": [
{
"match": {"global": true, "pkgname": ".", "fn": ".*_test.go"},
"snippets": [
{"text": "func Test", "title": "", "value": "func Test${1:ObjectName}${2:TestName}(t *testing.T) {\n\t$0\n}"},
{"text": "func Benchmark", "title": "", "value": "func Benchmark${1:ObjectName}${2:BenchmarkName}(b *testing.B) {\n\n\tb.StopTimer()\n\n\t$0\n\n\tb.StartTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\t\n\t}\n\n}"},
{"text": "func Example", "title": "", "value": "func Example${1:ObjectName}${2:ExampleName}() {\n\n\t$0\n\n\t// Output:\n\t// \n\n}"}
]
},
{
"match": {"global": true}, // these snippets will only be presented in the global scope
"snippets": [
{"text": "jt", "title": "json tag", "value": "`json:\"$1\"`"}
]
}
],
"on_save": [{
"cmd": "gs9o_run_many", "args": {
"commands":[
["clear"],
["sh", "if [ -f onsave.sh ]; then ./onsave.sh; else gofmt -s -w ./ && go build . errors && go test -i && go test && go vet && golint .; fi"]
],
"focus_view": false
}
}],
"autocomplete_suggest_imports": true,
"autocomplete_closures": true,
"fmt_cmd": ["goimports"],
"9o_show_end":true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment