aboutsummaryrefslogtreecommitdiff
path: root/template/go/snip-max-slice.go
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-23 12:16:30 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-23 12:16:30 +0900
commit670b6a9aa93ca98e45c15ddd1a4590aabc4a635b (patch)
tree9609dbc331edc0ee6c9f05faf82fe3d075c4aa2c /template/go/snip-max-slice.go
parentfbb650c33bd1dd791cc2e79b5b034301b7abbbe3 (diff)
downloadvim-sonictemplate-670b6a9aa93ca98e45c15ddd1a4590aabc4a635b.tar.gz
vim-sonictemplate-670b6a9aa93ca98e45c15ddd1a4590aabc4a635b.tar.bz2
vim-sonictemplate-670b6a9aa93ca98e45c15ddd1a4590aabc4a635b.zip
Add some templates
Diffstat (limited to 'template/go/snip-max-slice.go')
-rw-r--r--template/go/snip-max-slice.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/template/go/snip-max-slice.go b/template/go/snip-max-slice.go
new file mode 100644
index 0000000..4a022ba
--- /dev/null
+++ b/template/go/snip-max-slice.go
@@ -0,0 +1,9 @@
+func max(a []{{_input_:type}}) {{_input_:type}} {
+ m := a[0]
+ for _, v := range a {
+ if v > m {
+ m = v
+ }
+ }
+ return m
+}