From 19a3db3d0875275c33b4d7b70cf7e6e5f0bc9ae3 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 1 Dec 2016 10:08:51 +0100 Subject: [PATCH] bump funcmap@1.1.1 --- Dockerfile | 4 ++-- glide.lock | 6 +++--- glide.yaml | 2 +- vendor/github.com/moul/funcmap/funcmap.go | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index b64b0cf..b3e1aa9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM golang:1.7.3 +FROM znly/protoc +RUN apk --update add make git go rsync COPY . /go/src/github.com/moul/protoc-gen-gotemplate WORKDIR /go/src/github.com/moul/protoc-gen-gotemplate RUN go install . -ENTRYPOINT ["protoc-gen-gotemplate"] diff --git a/glide.lock b/glide.lock index 1003fdc..33cdd2a 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 6f0ff21a03d407a4a24bf299f8b80acc931e116457f5378867626c2de5c4265e -updated: 2016-11-06T18:32:18.567649309+01:00 +hash: 2a443d1134599077e30c079238e394224e207bdc81ba96b662bba20e906d7a13 +updated: 2016-12-01T10:18:17.659451258+01:00 imports: - name: github.com/golang/protobuf version: 98fa357170587e470c5f27d3c3ea0947b71eb455 @@ -11,5 +11,5 @@ imports: - name: github.com/kr/fs version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b - name: github.com/moul/funcmap - version: 916897fb9db8a358561b3c2cdb7bd4d7cf2eb1c7 + version: ae20ef49f610b7cb474d94afd71606af8fb09b77 testImports: [] diff --git a/glide.yaml b/glide.yaml index c9610ba..63eceb2 100644 --- a/glide.yaml +++ b/glide.yaml @@ -8,4 +8,4 @@ import: - protoc-gen-go/plugin - package: github.com/kr/fs - package: github.com/moul/funcmap - version: ~1.0.0 + version: ~1.1.1 diff --git a/vendor/github.com/moul/funcmap/funcmap.go b/vendor/github.com/moul/funcmap/funcmap.go index ad13b9d..a4fe228 100644 --- a/vendor/github.com/moul/funcmap/funcmap.go +++ b/vendor/github.com/moul/funcmap/funcmap.go @@ -2,6 +2,8 @@ package funcmap import ( "encoding/json" + "fmt" + "strconv" "strings" "text/template" ) @@ -21,6 +23,23 @@ var FuncMap = template.FuncMap{ "split": strings.Split, "join": strings.Join, "title": strings.Title, + "unexport": func(input string) string { + return fmt.Sprintf("%s%s", strings.ToLower(input[0:1]), input[1:]) + }, "lower": strings.ToLower, "upper": strings.ToUpper, + "rev": func(v interface{}) string { + runes := []rune(v.(string)) + for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { + runes[i], runes[j] = runes[j], runes[i] + } + return string(runes) + }, + "int": func(v interface{}) string { + a, err := strconv.Atoi(v.(string)) + if err != nil { + return fmt.Sprintf("%v", v) + } + return fmt.Sprintf("%d", a) + }, }