mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
Add/update various Go snippets
This commit is contained in:
9
snippets/go-mode/bench
Normal file
9
snippets/go-mode/bench
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributer: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
|
||||
# name: bench
|
||||
# key: bench
|
||||
# description: add a benchmark method
|
||||
# --
|
||||
func Benchmark${1:Feature}(b *testing.B) {
|
||||
$0
|
||||
}
|
||||
5
snippets/go-mode/el
Normal file
5
snippets/go-mode/el
Normal file
@@ -0,0 +1,5 @@
|
||||
# key: el
|
||||
# --
|
||||
else {
|
||||
$0
|
||||
}
|
||||
5
snippets/go-mode/elif
Normal file
5
snippets/go-mode/elif
Normal file
@@ -0,0 +1,5 @@
|
||||
# key: elif
|
||||
# --
|
||||
else if $1 {
|
||||
$0
|
||||
}
|
||||
5
snippets/go-mode/else
Normal file
5
snippets/go-mode/else
Normal file
@@ -0,0 +1,5 @@
|
||||
# key: else
|
||||
# --
|
||||
else {
|
||||
$0
|
||||
}
|
||||
5
snippets/go-mode/for
Normal file
5
snippets/go-mode/for
Normal file
@@ -0,0 +1,5 @@
|
||||
# key: for
|
||||
# --
|
||||
for $1 {
|
||||
$0
|
||||
}
|
||||
5
snippets/go-mode/fori
Normal file
5
snippets/go-mode/fori
Normal file
@@ -0,0 +1,5 @@
|
||||
# key: fori
|
||||
# --
|
||||
for i := 0; i < $1; i++ {
|
||||
$0
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
# name: func
|
||||
# key: func
|
||||
# --
|
||||
func ${1:name}($2) {
|
||||
$0
|
||||
}
|
||||
}
|
||||
6
snippets/go-mode/gof
Normal file
6
snippets/go-mode/gof
Normal file
@@ -0,0 +1,6 @@
|
||||
# name: go func(...) { ... }(...)
|
||||
# key: gof
|
||||
# --
|
||||
go func($1) {
|
||||
$0
|
||||
}($2)
|
||||
5
snippets/go-mode/if
Normal file
5
snippets/go-mode/if
Normal file
@@ -0,0 +1,5 @@
|
||||
# key: if
|
||||
# --
|
||||
if $1 {
|
||||
$0
|
||||
}
|
||||
7
snippets/go-mode/ifel
Normal file
7
snippets/go-mode/ifel
Normal file
@@ -0,0 +1,7 @@
|
||||
# key: ifel
|
||||
# --
|
||||
if $1 {
|
||||
$0
|
||||
} else {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
# name: interface
|
||||
# key: interface
|
||||
# --
|
||||
type ${1:InterfaceName} interface {
|
||||
$0
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
# name: main
|
||||
# key: main
|
||||
# --
|
||||
package main
|
||||
|
||||
7
snippets/go-mode/make
Normal file
7
snippets/go-mode/make
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributer: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
|
||||
# name: make
|
||||
# key: make
|
||||
# description: snippet for make builtin
|
||||
# --
|
||||
make(${1:Type}, ${2:startingSize}, ${3:memorySize})$0
|
||||
6
snippets/go-mode/meth
Normal file
6
snippets/go-mode/meth
Normal file
@@ -0,0 +1,6 @@
|
||||
# name: struct method
|
||||
# key: meth
|
||||
# --
|
||||
func (${1:s *Struct}) ${2:Name}($3) ${4:returnType} {
|
||||
$0
|
||||
}
|
||||
3
snippets/go-mode/mk
Normal file
3
snippets/go-mode/mk
Normal file
@@ -0,0 +1,3 @@
|
||||
# key: mk
|
||||
# --
|
||||
make($0)
|
||||
@@ -1,4 +1,3 @@
|
||||
# name: pd
|
||||
# key: pd
|
||||
# --
|
||||
fmt.Printf($0)
|
||||
fmt.Println($0)
|
||||
3
snippets/go-mode/pdf
Normal file
3
snippets/go-mode/pdf
Normal file
@@ -0,0 +1,3 @@
|
||||
# key: pdf
|
||||
# --
|
||||
fmt.Printf($0)
|
||||
@@ -1,4 +0,0 @@
|
||||
# name: pdl
|
||||
# key: pdl
|
||||
# --
|
||||
fmt.Println($0)
|
||||
6
snippets/go-mode/select
Normal file
6
snippets/go-mode/select
Normal file
@@ -0,0 +1,6 @@
|
||||
# key: select
|
||||
# --
|
||||
select {
|
||||
case $1:
|
||||
$0
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
# name: struct
|
||||
# key: struct
|
||||
# --
|
||||
type ${1:StructName} struct {
|
||||
|
||||
9
snippets/go-mode/test
Normal file
9
snippets/go-mode/test
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributer: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
|
||||
# name: test {}
|
||||
# key: test
|
||||
# description: add a test method
|
||||
# --
|
||||
func Test${1:Feature}(t *testing.T) {
|
||||
$0
|
||||
}
|
||||
Reference in New Issue
Block a user