aboutsummaryrefslogtreecommitdiff
path: root/template/go/snip-max-slice.go
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-23 22:03:34 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-23 22:03:34 +0900
commite01b6d01f7b29be14fac83d0d10d1f364af97055 (patch)
tree6ec1691235c70e8959f59e3334e0e6bdb0a0d59c /template/go/snip-max-slice.go
parent7292342afd74b9cc812a727b12ce42626c7886ef (diff)
parent670b6a9aa93ca98e45c15ddd1a4590aabc4a635b (diff)
downloadvim-sonictemplate-e01b6d01f7b29be14fac83d0d10d1f364af97055.tar.gz
vim-sonictemplate-e01b6d01f7b29be14fac83d0d10d1f364af97055.tar.bz2
vim-sonictemplate-e01b6d01f7b29be14fac83d0d10d1f364af97055.zip
Merge branch 'master' of https://github.com/mattn/sonictemplate-vim
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
+}