From bec037ce640547d94b72eb51bacfba49571e2ea3 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.0 --- 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..d7cf7c3 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 6f0ff21a03d407a4a24bf299f8b80acc931e116457f5378867626c2de5c4265e -updated: 2016-11-06T18:32:18.567649309+01:00 +hash: 8e73e008df139d080692c91cd6c55549bbb6490f00ea67ee7ae1fbf6facedc86 +updated: 2016-12-01T10:08:09.672752932+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: f798117cf01752496ce9b8739b2b1ed21e3a6c1c testImports: [] diff --git a/glide.yaml b/glide.yaml index c9610ba..f9d46bc 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.0 diff --git a/vendor/github.com/moul/funcmap/funcmap.go b/vendor/github.com/moul/funcmap/funcmap.go index ad13b9d..8ba0106 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(v interface{}) string { + return fmt.Sprintf("%s%s", strings.ToLower(v.(string)[0:1]), v.(string)[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) + }, }