feat(snippets): add various snippets for go-mode

This commit is contained in:
2021-01-15 01:53:16 +00:00
parent 8329c7e912
commit d79e9999fd
5 changed files with 44 additions and 0 deletions

7
snippets/go-mode/ie Normal file
View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: if error
# key: ife
# --
if err != nil {
return ${0:err}
}

4
snippets/go-mode/lpd Normal file
View File

@@ -0,0 +1,4 @@
# name: log.Printf("[DEBUG] ...\n", ...)
# key: lpd
# --
log.Printf("[DEBUG] $1\n"$2)$0

4
snippets/go-mode/lppd Normal file
View File

@@ -0,0 +1,4 @@
# name: log.Printf("[DEBUG] ...: %+v\n", ...)
# key: lppd
# --
log.Printf("[DEBUG] $1: %+v\n", $1)$0

18
snippets/go-mode/tf Normal file
View File

@@ -0,0 +1,18 @@
# name: func TestName(t *testing.T) { tests := []struct{ ... } ... }
# key: tf
# --
func Test${1:Name}(t *testing.T) {
tests := []struct {
name string
$0
}{
{
name: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
})
}
}

11
snippets/go-mode/tt Normal file
View File

@@ -0,0 +1,11 @@
# name: tests := []struct{ ... }
# key: tt
# --
tests := []struct {
name string
$0
}{
{
name: "",
},
}