From a942cbb2db49d1ee785f7a1c5be94a50a0fdccd8 Mon Sep 17 00:00:00 2001 From: Namit Date: Tue, 3 Mar 2015 16:04:52 -0800 Subject: [PATCH 1/3] Add error handling in go.snippets --- UltiSnips/go.snippets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets index efd1589..539f960 100644 --- a/UltiSnips/go.snippets +++ b/UltiSnips/go.snippets @@ -135,3 +135,10 @@ snippet json "JSON field" endsnippet # vim:ft=snippets: + +# error handling +snippet err "Basic error handling" b +if err != nil { + log.${1:Fatal}(err) +} +endsnippet From 4dae57d0a29a643fd11ac5f9c4a1b0f3d89911a8 Mon Sep 17 00:00:00 2001 From: Namit Date: Tue, 3 Mar 2015 16:32:08 -0800 Subject: [PATCH 2/3] Add HTTP handler in go.snippets --- UltiSnips/go.snippets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets index 539f960..ab3bcbd 100644 --- a/UltiSnips/go.snippets +++ b/UltiSnips/go.snippets @@ -111,6 +111,12 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { } endsnippet +snippet funch "HTTP handler" b +func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) { + ${0:${VISUAL}} +} +endsnippet + # types and variables snippet map "Map type" b map[${1:keytype}]${2:valtype} From 6a11038301046c5d1f9000b5c713ef806f240b70 Mon Sep 17 00:00:00 2001 From: Namit Date: Wed, 4 Mar 2015 08:56:17 -0800 Subject: [PATCH 3/3] Replace two space indentation with tab --- UltiSnips/go.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets index ab3bcbd..780ee29 100644 --- a/UltiSnips/go.snippets +++ b/UltiSnips/go.snippets @@ -145,6 +145,6 @@ endsnippet # error handling snippet err "Basic error handling" b if err != nil { - log.${1:Fatal}(err) + log.${1:Fatal}(err) } endsnippet