aboutsummaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
Diffstat (limited to 'template')
-rw-r--r--template/go/snip-err-log-fatal.go3
-rw-r--r--template/go/snip-err-return.go3
-rw-r--r--template/go/snip-test-table-driven.go19
-rw-r--r--template/go/snip-time-date.go1
-rw-r--r--template/go/snip-time-format-yyyymmddHHMMss-micro.go1
-rw-r--r--template/go/snip-time-format-yyyymmddHHMMss-milli.go1
-rw-r--r--template/go/snip-time-format-yyyymmddHHMMss-nano.go1
7 files changed, 29 insertions, 0 deletions
diff --git a/template/go/snip-err-log-fatal.go b/template/go/snip-err-log-fatal.go
new file mode 100644
index 0000000..48a2c6b
--- /dev/null
+++ b/template/go/snip-err-log-fatal.go
@@ -0,0 +1,3 @@
+if err != nil {
+ log.Fatal(err)
+}
diff --git a/template/go/snip-err-return.go b/template/go/snip-err-return.go
new file mode 100644
index 0000000..4936685
--- /dev/null
+++ b/template/go/snip-err-return.go
@@ -0,0 +1,3 @@
+if err != nil {
+ return err
+}
diff --git a/template/go/snip-test-table-driven.go b/template/go/snip-test-table-driven.go
new file mode 100644
index 0000000..f98786d
--- /dev/null
+++ b/template/go/snip-test-table-driven.go
@@ -0,0 +1,19 @@
+func Test{{_cursor_}}(t *testing.T) {
+ tests := []struct{
+ name string
+ want int
+ }{
+ {
+ name: "case1",
+ want: 1,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T){
+ got := 1
+ if got != tt.want {
+ t.Fatalf("want %v, but %v:", tt.want, got)
+ }
+ })
+ }
+}
diff --git a/template/go/snip-time-date.go b/template/go/snip-time-date.go
new file mode 100644
index 0000000..664ebf4
--- /dev/null
+++ b/template/go/snip-time-date.go
@@ -0,0 +1 @@
+tm := time.Date(2006, time.January, 2, 15, 4, 5, 0, time.Local)
diff --git a/template/go/snip-time-format-yyyymmddHHMMss-micro.go b/template/go/snip-time-format-yyyymmddHHMMss-micro.go
new file mode 100644
index 0000000..833f945
--- /dev/null
+++ b/template/go/snip-time-format-yyyymmddHHMMss-micro.go
@@ -0,0 +1 @@
+"2006/01/02 15:04:05.000000"
diff --git a/template/go/snip-time-format-yyyymmddHHMMss-milli.go b/template/go/snip-time-format-yyyymmddHHMMss-milli.go
new file mode 100644
index 0000000..b4fba80
--- /dev/null
+++ b/template/go/snip-time-format-yyyymmddHHMMss-milli.go
@@ -0,0 +1 @@
+"2006/01/02 15:04:05.000"
diff --git a/template/go/snip-time-format-yyyymmddHHMMss-nano.go b/template/go/snip-time-format-yyyymmddHHMMss-nano.go
new file mode 100644
index 0000000..cb9c57b
--- /dev/null
+++ b/template/go/snip-time-format-yyyymmddHHMMss-nano.go
@@ -0,0 +1 @@
+"2006/01/02 15:04:05.000000000"