Compare commits
1 Commits
v1.8.0
...
dev/moul/e
Author | SHA1 | Date | |
---|---|---|---|
|
71d0e94753 |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
|||||||
* @moul
|
|
6
.github/FUNDING.yml
vendored
6
.github/FUNDING.yml
vendored
@@ -1,6 +0,0 @@
|
|||||||
#github: ["moul"]
|
|
||||||
patreon: moul
|
|
||||||
open_collective: moul
|
|
||||||
custom:
|
|
||||||
- "https://www.buymeacoffee.com/moul"
|
|
||||||
- "https://manfred.life/donate"
|
|
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: "[BUG] "
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
1. Go to '...'
|
|
||||||
2. Type '....'
|
|
||||||
3. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots / Logs**
|
|
||||||
If applicable, add screenshots or logs to help explain your problem.
|
|
||||||
|
|
||||||
**Versions (please complete the following information, if relevant):**
|
|
||||||
- Software version: [e.g. v1.2.3, latest, building from sources]
|
|
||||||
- OS: [e.g. Ubuntu, Mac, iOS, ...]
|
|
||||||
- Golang version [e.g. 1.13]
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
8
.github/ISSUE_TEMPLATE/custom.md
vendored
8
.github/ISSUE_TEMPLATE/custom.md
vendored
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
name: Custom
|
|
||||||
about: 'Anything else: questions, discussions, thanks, ascii-arts, ...'
|
|
||||||
title: ''
|
|
||||||
labels: discussion
|
|
||||||
assignees: moul
|
|
||||||
|
|
||||||
---
|
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: "[IDEA] "
|
|
||||||
labels: enhancement
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,9 +0,0 @@
|
|||||||
<!--
|
|
||||||
Thank you for your contribution to this repo!
|
|
||||||
|
|
||||||
Before submitting a pull request, please check the following:
|
|
||||||
- reference any related issue, PR, link
|
|
||||||
- use the "WIP" title prefix if you need help or more time to finish your PR
|
|
||||||
|
|
||||||
you can remove this markdown comment
|
|
||||||
-->
|
|
6
.github/renovate.json
vendored
6
.github/renovate.json
vendored
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
],
|
|
||||||
"groupName": "all"
|
|
||||||
}
|
|
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -1,13 +0,0 @@
|
|||||||
name: Semantic Release
|
|
||||||
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
semantic-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- uses: codfish/semantic-release-action@v1
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,34 +0,0 @@
|
|||||||
run:
|
|
||||||
deadline: 1m
|
|
||||||
tests: false
|
|
||||||
#skip-files:
|
|
||||||
# - ".*\\.gen\\.go"
|
|
||||||
|
|
||||||
linters-settings:
|
|
||||||
golint:
|
|
||||||
min-confidence: 0
|
|
||||||
maligned:
|
|
||||||
suggest-new: true
|
|
||||||
goconst:
|
|
||||||
min-len: 5
|
|
||||||
min-occurrences: 4
|
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
|
|
||||||
linters:
|
|
||||||
disable-all: true
|
|
||||||
enable:
|
|
||||||
- goconst
|
|
||||||
- misspell
|
|
||||||
- deadcode
|
|
||||||
- misspell
|
|
||||||
- structcheck
|
|
||||||
- errcheck
|
|
||||||
- unused
|
|
||||||
- varcheck
|
|
||||||
- staticcheck
|
|
||||||
- unconvert
|
|
||||||
- gofmt
|
|
||||||
- goimports
|
|
||||||
- golint
|
|
||||||
- ineffassign
|
|
@@ -1,8 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
branch: 'master',
|
|
||||||
plugins: [
|
|
||||||
'@semantic-release/commit-analyzer',
|
|
||||||
'@semantic-release/release-notes-generator',
|
|
||||||
'@semantic-release/github',
|
|
||||||
],
|
|
||||||
};
|
|
@@ -3,14 +3,15 @@ go: 1.11.x
|
|||||||
go_import_path: moul.io/protoc-gen-gotemplate
|
go_import_path: moul.io/protoc-gen-gotemplate
|
||||||
install:
|
install:
|
||||||
- go get github.com/Masterminds/glide
|
- go get github.com/Masterminds/glide
|
||||||
- wget https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v1.5.0/.travis/install-protoc.sh && chmod +x install-protoc.sh && ./install-protoc.sh 3.4.0
|
- wget https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/.travis/install-protoc.sh && chmod +x install-protoc.sh && ./install-protoc.sh 3.4.0
|
||||||
- go get -u github.com/golang/protobuf/protoc-gen-go
|
- go get -u github.com/golang/protobuf/protoc-gen-go
|
||||||
- go get github.com/securego/gosec/cmd/gosec/...
|
- go get github.com/securego/gosec/cmd/gosec/...
|
||||||
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.12.2
|
- go get -u github.com/alecthomas/gometalinter
|
||||||
|
- gometalinter --install
|
||||||
script:
|
script:
|
||||||
- make install
|
- make install
|
||||||
- make test
|
- make test
|
||||||
- PATH=$PATH:$(pwd)/bin make lint
|
- make lint
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/local
|
- $HOME/local
|
||||||
|
2
Makefile
2
Makefile
@@ -33,4 +33,4 @@ docker.push: docker.build
|
|||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
golangci-lint run --verbose . ./helpers ./cmd/...
|
gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=golint --enable=gosec --enable=ineffassign --enable=goconst --enable=goimports --enable=gofmt --exclude="Binds to all network interfaces" --exclude="should have comment" --enable=staticcheck --enable=gosimple --enable=misspell --deadline=120s . ./cmd/... ./helpers/...
|
||||||
|
85
README.md
85
README.md
@@ -76,57 +76,56 @@ This project uses [Masterminds/sprig](https://github.com/Masterminds/sprig) libr
|
|||||||
Non-exhaustive list of new helpers:
|
Non-exhaustive list of new helpers:
|
||||||
|
|
||||||
* **all the functions from [sprig](https://github.com/Masterminds/sprig)**
|
* **all the functions from [sprig](https://github.com/Masterminds/sprig)**
|
||||||
* `add`
|
* `string`
|
||||||
* `boolFieldExtension`
|
* `json`
|
||||||
* `camelCase`
|
* `prettyjson`
|
||||||
* `contains`
|
* `splitArray`
|
||||||
* `divide`
|
|
||||||
* `fieldMapKeyType`
|
|
||||||
* `fieldMapValueType`
|
|
||||||
* `first`
|
* `first`
|
||||||
* `getEnumValue`
|
* `last`
|
||||||
* `getMessageType`
|
* `upperFirst`
|
||||||
|
* `lowerFirst`
|
||||||
|
* `camelCase`
|
||||||
|
* `lowerCamelCase`
|
||||||
|
* `kebabCase`
|
||||||
|
* `contains`
|
||||||
|
* `trimstr`
|
||||||
|
* `index`
|
||||||
|
* `snakeCase`
|
||||||
* `getProtoFile`
|
* `getProtoFile`
|
||||||
* `goNormalize`
|
* `getMessageType`
|
||||||
* `goTypeWithPackage`
|
* `getEnumValue`
|
||||||
|
* `isFieldMessage`
|
||||||
|
* `isFieldMessageTimeStamp`
|
||||||
|
* `isFieldRepeated`
|
||||||
|
* `haskellType`
|
||||||
* `goType`
|
* `goType`
|
||||||
* `goZeroValue`
|
* `goZeroValue`
|
||||||
* `haskellType`
|
* `goTypeWithPackage`
|
||||||
* `httpBody`
|
* `jsType`
|
||||||
|
* `jsSuffixReserved`
|
||||||
|
* `namespacedFlowType`
|
||||||
|
* `httpVerb`
|
||||||
* `httpPath`
|
* `httpPath`
|
||||||
* `httpPathsAdditionalBindings`
|
* `httpPathsAdditionalBindings`
|
||||||
* `httpVerb`
|
* `httpBody`
|
||||||
* `index`
|
|
||||||
* `int64FieldExtension`
|
|
||||||
* `isFieldMap`
|
|
||||||
* `isFieldMessageTimeStamp`
|
|
||||||
* `isFieldMessage`
|
|
||||||
* `isFieldRepeated`
|
|
||||||
* `jsSuffixReserved`
|
|
||||||
* `jsType`
|
|
||||||
* `json`
|
|
||||||
* `kebabCase`
|
|
||||||
* `last`
|
|
||||||
* `leadingComment`
|
|
||||||
* `leadingDetachedComments`
|
|
||||||
* `lowerCamelCase`
|
|
||||||
* `lowerFirst`
|
|
||||||
* `lowerGoNormalize`
|
|
||||||
* `multiply`
|
|
||||||
* `namespacedFlowType`
|
|
||||||
* `prettyjson`
|
|
||||||
* `replaceDict`
|
|
||||||
* `shortType`
|
* `shortType`
|
||||||
* `snakeCase`
|
* `urlHasVarsFromMessage`
|
||||||
* `splitArray`
|
* `lowerGoNormalize`
|
||||||
|
* `goNormalize`
|
||||||
|
* `leadingComment`
|
||||||
|
* `trailingComment`
|
||||||
|
* `leadingDetachedComments`
|
||||||
* `stringFieldExtension`
|
* `stringFieldExtension`
|
||||||
* `stringMethodOptionsExtension`
|
* `stringMethodOptionsExtension`
|
||||||
* `string`
|
* `boolFieldExtension`
|
||||||
|
* `isFieldMap`
|
||||||
|
* `fieldMapKeyType`
|
||||||
|
* `fieldMapValueType`
|
||||||
|
* `replaceDict`
|
||||||
|
* `add`
|
||||||
* `subtract`
|
* `subtract`
|
||||||
* `trailingComment`
|
* `multiply`
|
||||||
* `trimstr`
|
* `divide`
|
||||||
* `upperFirst`
|
|
||||||
* `urlHasVarsFromMessage`
|
|
||||||
|
|
||||||
See the project helpers for the complete list.
|
See the project helpers for the complete list.
|
||||||
|
|
||||||
@@ -153,10 +152,6 @@ $> docker run --rm -v "$(pwd):$(pwd)" -w "$(pwd)" moul/protoc-gen-gotemplate -I.
|
|||||||
* [translator](https://github.com/moul/translator): Translator Micro-service using Gettext and Go-Kit
|
* [translator](https://github.com/moul/translator): Translator Micro-service using Gettext and Go-Kit
|
||||||
* [acl](https://github.com/moul/acl): ACL micro-service (gRPC/protobuf + http/json)
|
* [acl](https://github.com/moul/acl): ACL micro-service (gRPC/protobuf + http/json)
|
||||||
|
|
||||||
## See also
|
|
||||||
|
|
||||||
* [pbhbs](https://github.com/gponsinet/pbhbs): protobuf gen based on handlebarjs template
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
/Users/moul/go/src/moul.io/protoc-gen-gotemplate/assets:
|
|
||||||
total used in directory 552 available 9223372036849978910
|
|
||||||
drwxr-xr-x 4 moul staff 128 Dec 9 11:31 .
|
|
||||||
lrwxr-xr-x 1 moul staff 33 Dec 9 11:31 .#web-editor.jpg -> moul@manfred-spacegray.local.9471
|
|
||||||
drwxr-xr-x 21 moul staff 672 Sep 13 18:05 ..
|
|
||||||
-rw-r--r--@ 1 moul staff 280357 Oct 26 2017 web-editor.jpg
|
|
@@ -11,7 +11,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/protoc-gen-go/descriptor"
|
"github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||||
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
|
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
||||||
|
|
||||||
pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
|
pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
|
||||||
)
|
)
|
||||||
@@ -210,8 +210,10 @@ func (e *GenericTemplateBasedEncoder) Files() []*plugin_go.CodeGeneratorResponse
|
|||||||
case f := <-resultChan:
|
case f := <-resultChan:
|
||||||
files = append(files, f)
|
files = append(files, f)
|
||||||
case err = <-errChan:
|
case err = <-errChan:
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
oldcontext "golang.org/x/net/context"
|
|
||||||
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
|
oldcontext "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = endpoint.Chain
|
var _ = endpoint.Chain
|
||||||
|
@@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
oldcontext "golang.org/x/net/context"
|
|
||||||
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
|
oldcontext "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = endpoint.Chain
|
var _ = endpoint.Chain
|
||||||
|
@@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
oldcontext "golang.org/x/net/context"
|
|
||||||
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
|
oldcontext "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = endpoint.Chain
|
var _ = endpoint.Chain
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
package company
|
package company
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
|
|
||||||
"moul.io/protoc-gen-gotemplate/examples/import/output/models/article"
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/article"
|
||||||
"moul.io/protoc-gen-gotemplate/examples/import/output/models/common"
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/common"
|
||||||
)
|
)
|
||||||
@@ -12,8 +10,20 @@ type Repository interface {
|
|||||||
GetArticle(getarticle *common.GetArticle ) (*company.Article, []*company.Storage, error)
|
GetArticle(getarticle *common.GetArticle ) (*company.Article, []*company.Storage, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------- Public SDK -----------------------------
|
// ------------------------- Public SDK -----------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// GetArticle : proto: missing extension proto: missing extension
|
// GetArticle : proto: missing extension proto: missing extension
|
||||||
func (sdk *Sdk) GetArticle(ctx context.Context,
|
func (sdk *Sdk) GetArticle(ctx context.Context,
|
||||||
getarticle *article.GetArticle, token, requestID string)(article *article.Article, storages []*article.GetArticleResponse_Storage, err error) {
|
getarticle *article.GetArticle, token, requestID string)(article *article.Article, storages []*article.GetArticleResponse_Storage, err error) {
|
||||||
@@ -21,6 +31,10 @@ func (sdk *Sdk) GetArticle(ctx context.Context,
|
|||||||
out := &pb.GetArticleResponse{}
|
out := &pb.GetArticleResponse{}
|
||||||
_ = out
|
_ = out
|
||||||
|
|
||||||
|
|
||||||
return out.Article, out.Storages, nil
|
return out.Article, out.Storages, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,8 +4,8 @@ package bbb
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"
|
"moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"
|
||||||
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct{}
|
type Service struct{}
|
||||||
|
9
go.mod
9
go.mod
@@ -4,6 +4,7 @@ require (
|
|||||||
github.com/Masterminds/semver v1.2.2 // indirect
|
github.com/Masterminds/semver v1.2.2 // indirect
|
||||||
github.com/Masterminds/sprig v2.14.1+incompatible
|
github.com/Masterminds/sprig v2.14.1+incompatible
|
||||||
github.com/aokoli/goutils v0.0.0-20170502144750-e57d01ace047 // indirect
|
github.com/aokoli/goutils v0.0.0-20170502144750-e57d01ace047 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
|
||||||
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b
|
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b
|
||||||
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect
|
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect
|
||||||
@@ -12,10 +13,12 @@ require (
|
|||||||
github.com/grpc-ecosystem/grpc-gateway v1.2.2
|
github.com/grpc-ecosystem/grpc-gateway v1.2.2
|
||||||
github.com/huandu/xstrings v0.0.0-20151130125119-3959339b3335
|
github.com/huandu/xstrings v0.0.0-20151130125119-3959339b3335
|
||||||
github.com/imdario/mergo v0.0.0-20171009183408-7fe0c75c13ab // indirect
|
github.com/imdario/mergo v0.0.0-20171009183408-7fe0c75c13ab // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/satori/go.uuid v1.1.0 // indirect
|
github.com/satori/go.uuid v1.1.0 // indirect
|
||||||
github.com/stretchr/testify v1.3.0 // indirect
|
github.com/stretchr/testify v1.2.2 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20170516161655-0fe963104e9d // indirect
|
golang.org/x/crypto v0.0.0-20170516161655-0fe963104e9d // indirect
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
|
golang.org/x/net v0.0.0-20170108160505-da2b4fa28524 // indirect
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
|
||||||
google.golang.org/genproto v0.0.0-20170517234824-bb3573be0c48
|
google.golang.org/genproto v0.0.0-20170517234824-bb3573be0c48
|
||||||
gopkg.in/yaml.v2 v2.2.2 // indirect
|
gopkg.in/yaml.v2 v2.2.1 // indirect
|
||||||
)
|
)
|
||||||
|
19
go.sum
19
go.sum
@@ -4,8 +4,8 @@ github.com/Masterminds/sprig v2.14.1+incompatible h1:rTHERm50Xp1Cbb8x7xBCeDp//jM
|
|||||||
github.com/Masterminds/sprig v2.14.1+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
|
github.com/Masterminds/sprig v2.14.1+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
|
||||||
github.com/aokoli/goutils v0.0.0-20170502144750-e57d01ace047 h1:Bn0iqJ/349f606hR0juIGyheAI6+hyg9XUOLhN9udLo=
|
github.com/aokoli/goutils v0.0.0-20170502144750-e57d01ace047 h1:Bn0iqJ/349f606hR0juIGyheAI6+hyg9XUOLhN9udLo=
|
||||||
github.com/aokoli/goutils v0.0.0-20170502144750-e57d01ace047/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
|
github.com/aokoli/goutils v0.0.0-20170502144750-e57d01ace047/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
|
||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b h1:fE/yi9pibxGEc0gSJuEShcsBXE2d5FW3OudsjE9tKzQ=
|
github.com/golang/protobuf v0.0.0-20161117033126-8ee79997227b h1:fE/yi9pibxGEc0gSJuEShcsBXE2d5FW3OudsjE9tKzQ=
|
||||||
@@ -26,16 +26,17 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/satori/go.uuid v1.1.0 h1:B9KXyj+GzIpJbV7gmr873NsY6zpbxNy24CBtGrk7jHo=
|
github.com/satori/go.uuid v1.1.0 h1:B9KXyj+GzIpJbV7gmr873NsY6zpbxNy24CBtGrk7jHo=
|
||||||
github.com/satori/go.uuid v1.1.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
github.com/satori/go.uuid v1.1.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
golang.org/x/crypto v0.0.0-20170516161655-0fe963104e9d h1:qjfFh1YMn6m60QTGoG+IlwUMhNlXJbDyCa6EkHM/N2w=
|
golang.org/x/crypto v0.0.0-20170516161655-0fe963104e9d h1:qjfFh1YMn6m60QTGoG+IlwUMhNlXJbDyCa6EkHM/N2w=
|
||||||
golang.org/x/crypto v0.0.0-20170516161655-0fe963104e9d/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20170516161655-0fe963104e9d/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
golang.org/x/net v0.0.0-20170108160505-da2b4fa28524 h1:h2R5t9TXOJ/PVrYAFToVQe0c5AIMZPmlEKFhmYS1iGs=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/net v0.0.0-20170108160505-da2b4fa28524/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
google.golang.org/genproto v0.0.0-20170517234824-bb3573be0c48 h1:xfoW+Di7qQQUnjptcGb4/rpc701e3RvfNmaywfMxQVI=
|
google.golang.org/genproto v0.0.0-20170517234824-bb3573be0c48 h1:xfoW+Di7qQQUnjptcGb4/rpc701e3RvfNmaywfMxQVI=
|
||||||
google.golang.org/genproto v0.0.0-20170517234824-bb3573be0c48/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20170517234824-bb3573be0c48/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
@@ -94,15 +94,15 @@ var ProtoHelpersFuncMap = template.FuncMap{
|
|||||||
"trimstr": func(cutset, s string) string {
|
"trimstr": func(cutset, s string) string {
|
||||||
return strings.Trim(s, cutset)
|
return strings.Trim(s, cutset)
|
||||||
},
|
},
|
||||||
"index": func(array interface{}, i int) interface{} {
|
"index": func(array interface{}, i int32) interface{} {
|
||||||
slice := reflect.ValueOf(array)
|
slice := reflect.ValueOf(array)
|
||||||
if slice.Kind() != reflect.Slice {
|
if slice.Kind() != reflect.Slice {
|
||||||
panic("Error in index(): given a non-slice type")
|
panic("Error in index(): given a non-slice type")
|
||||||
}
|
}
|
||||||
if i < 0 || i >= slice.Len() {
|
if i < 0 || int(i) >= slice.Len() {
|
||||||
panic("Error in index(): index out of bounds")
|
panic("Error in index(): index out of bounds")
|
||||||
}
|
}
|
||||||
return slice.Index(i).Interface()
|
return slice.Index(int(i)).Interface()
|
||||||
},
|
},
|
||||||
"add": func(a int, b int) int {
|
"add": func(a int, b int) int {
|
||||||
return a + b
|
return a + b
|
||||||
@@ -146,14 +146,9 @@ var ProtoHelpersFuncMap = template.FuncMap{
|
|||||||
"leadingComment": leadingComment,
|
"leadingComment": leadingComment,
|
||||||
"trailingComment": trailingComment,
|
"trailingComment": trailingComment,
|
||||||
"leadingDetachedComments": leadingDetachedComments,
|
"leadingDetachedComments": leadingDetachedComments,
|
||||||
"stringFileOptionsExtension": stringFileOptionsExtension,
|
|
||||||
"stringMessageExtension": stringMessageExtension,
|
|
||||||
"stringFieldExtension": stringFieldExtension,
|
"stringFieldExtension": stringFieldExtension,
|
||||||
"int64FieldExtension": int64FieldExtension,
|
|
||||||
"int64MessageExtension": int64MessageExtension,
|
|
||||||
"stringMethodOptionsExtension": stringMethodOptionsExtension,
|
"stringMethodOptionsExtension": stringMethodOptionsExtension,
|
||||||
"boolMethodOptionsExtension": boolMethodOptionsExtension,
|
"boolMethodOptionsExtension": boolMethodOptionsExtension,
|
||||||
"boolMessageExtension": boolMessageExtension,
|
|
||||||
"boolFieldExtension": boolFieldExtension,
|
"boolFieldExtension": boolFieldExtension,
|
||||||
"isFieldMap": isFieldMap,
|
"isFieldMap": isFieldMap,
|
||||||
"fieldMapKeyType": fieldMapKeyType,
|
"fieldMapKeyType": fieldMapKeyType,
|
||||||
@@ -161,8 +156,6 @@ var ProtoHelpersFuncMap = template.FuncMap{
|
|||||||
"replaceDict": replaceDict,
|
"replaceDict": replaceDict,
|
||||||
"setStore": setStore,
|
"setStore": setStore,
|
||||||
"getStore": getStore,
|
"getStore": getStore,
|
||||||
"goPkg": goPkg,
|
|
||||||
"goPkgLastElement": goPkgLastElement,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathMap map[interface{}]*descriptor.SourceCodeInfo_Location
|
var pathMap map[interface{}]*descriptor.SourceCodeInfo_Location
|
||||||
@@ -289,12 +282,12 @@ func samePath(a, b []int32) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/*func findSourceInfoLocation(i interface{}) *descriptor.SourceCodeInfo_Location {
|
func findSourceInfoLocation(i interface{}) *descriptor.SourceCodeInfo_Location {
|
||||||
if pathMap == nil {
|
if pathMap == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return pathMap[i]
|
return pathMap[i]
|
||||||
}*/
|
}
|
||||||
|
|
||||||
func leadingComment(i interface{}) string {
|
func leadingComment(i interface{}) string {
|
||||||
loc := pathMap[i]
|
loc := pathMap[i]
|
||||||
@@ -349,46 +342,6 @@ func stringMethodOptionsExtension(fieldID int32, f *descriptor.MethodDescriptorP
|
|||||||
return *str
|
return *str
|
||||||
}
|
}
|
||||||
|
|
||||||
// stringFileOptionsExtension extracts file options of a string type.
|
|
||||||
// To define your own extensions see:
|
|
||||||
// https://developers.google.com/protocol-buffers/docs/proto#customoptions
|
|
||||||
// Typically the fieldID of private extensions should be in the range:
|
|
||||||
// 50000-99999
|
|
||||||
func stringFileOptionsExtension(fieldID int32, f *descriptor.FileDescriptorProto) string {
|
|
||||||
if f == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if f.Options == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
var extendedType *descriptor.FileOptions
|
|
||||||
var extensionType *string
|
|
||||||
|
|
||||||
eds := proto.RegisteredExtensions(f.Options)
|
|
||||||
if eds[fieldID] == nil {
|
|
||||||
ed := &proto.ExtensionDesc{
|
|
||||||
ExtendedType: extendedType,
|
|
||||||
ExtensionType: extensionType,
|
|
||||||
Field: fieldID,
|
|
||||||
Tag: fmt.Sprintf("bytes,%d", fieldID),
|
|
||||||
}
|
|
||||||
proto.RegisterExtension(ed)
|
|
||||||
eds = proto.RegisteredExtensions(f.Options)
|
|
||||||
}
|
|
||||||
|
|
||||||
ext, err := proto.GetExtension(f.Options, eds[fieldID])
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
str, ok := ext.(*string)
|
|
||||||
if !ok {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return *str
|
|
||||||
}
|
|
||||||
|
|
||||||
func stringFieldExtension(fieldID int32, f *descriptor.FieldDescriptorProto) string {
|
func stringFieldExtension(fieldID int32, f *descriptor.FieldDescriptorProto) string {
|
||||||
if f == nil {
|
if f == nil {
|
||||||
return ""
|
return ""
|
||||||
@@ -424,111 +377,6 @@ func stringFieldExtension(fieldID int32, f *descriptor.FieldDescriptorProto) str
|
|||||||
return *str
|
return *str
|
||||||
}
|
}
|
||||||
|
|
||||||
func int64FieldExtension(fieldID int32, f *descriptor.FieldDescriptorProto) int64 {
|
|
||||||
if f == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
if f.Options == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var extendedType *descriptor.FieldOptions
|
|
||||||
var extensionType *int64
|
|
||||||
|
|
||||||
eds := proto.RegisteredExtensions(f.Options)
|
|
||||||
if eds[fieldID] == nil {
|
|
||||||
ed := &proto.ExtensionDesc{
|
|
||||||
ExtendedType: extendedType,
|
|
||||||
ExtensionType: extensionType,
|
|
||||||
Field: fieldID,
|
|
||||||
Tag: fmt.Sprintf("varint,%d", fieldID),
|
|
||||||
}
|
|
||||||
proto.RegisterExtension(ed)
|
|
||||||
eds = proto.RegisteredExtensions(f.Options)
|
|
||||||
}
|
|
||||||
|
|
||||||
ext, err := proto.GetExtension(f.Options, eds[fieldID])
|
|
||||||
if err != nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
i, ok := ext.(*int64)
|
|
||||||
if !ok {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
return *i
|
|
||||||
}
|
|
||||||
|
|
||||||
func int64MessageExtension(fieldID int32, f *descriptor.DescriptorProto) int64 {
|
|
||||||
if f == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
if f.Options == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var extendedType *descriptor.MessageOptions
|
|
||||||
var extensionType *int64
|
|
||||||
|
|
||||||
eds := proto.RegisteredExtensions(f.Options)
|
|
||||||
if eds[fieldID] == nil {
|
|
||||||
ed := &proto.ExtensionDesc{
|
|
||||||
ExtendedType: extendedType,
|
|
||||||
ExtensionType: extensionType,
|
|
||||||
Field: fieldID,
|
|
||||||
Tag: fmt.Sprintf("varint,%d", fieldID),
|
|
||||||
}
|
|
||||||
proto.RegisterExtension(ed)
|
|
||||||
eds = proto.RegisteredExtensions(f.Options)
|
|
||||||
}
|
|
||||||
|
|
||||||
ext, err := proto.GetExtension(f.Options, eds[fieldID])
|
|
||||||
if err != nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
i, ok := ext.(*int64)
|
|
||||||
if !ok {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
return *i
|
|
||||||
}
|
|
||||||
|
|
||||||
func stringMessageExtension(fieldID int32, f *descriptor.DescriptorProto) string {
|
|
||||||
if f == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if f.Options == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
var extendedType *descriptor.MessageOptions
|
|
||||||
var extensionType *string
|
|
||||||
|
|
||||||
eds := proto.RegisteredExtensions(f.Options)
|
|
||||||
if eds[fieldID] == nil {
|
|
||||||
ed := &proto.ExtensionDesc{
|
|
||||||
ExtendedType: extendedType,
|
|
||||||
ExtensionType: extensionType,
|
|
||||||
Field: fieldID,
|
|
||||||
Tag: fmt.Sprintf("bytes,%d", fieldID),
|
|
||||||
}
|
|
||||||
proto.RegisterExtension(ed)
|
|
||||||
eds = proto.RegisteredExtensions(f.Options)
|
|
||||||
}
|
|
||||||
|
|
||||||
ext, err := proto.GetExtension(f.Options, eds[fieldID])
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
str, ok := ext.(*string)
|
|
||||||
if !ok {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return *str
|
|
||||||
}
|
|
||||||
|
|
||||||
func boolMethodOptionsExtension(fieldID int32, f *descriptor.MethodDescriptorProto) bool {
|
func boolMethodOptionsExtension(fieldID int32, f *descriptor.MethodDescriptorProto) bool {
|
||||||
if f == nil {
|
if f == nil {
|
||||||
return false
|
return false
|
||||||
@@ -545,7 +393,7 @@ func boolMethodOptionsExtension(fieldID int32, f *descriptor.MethodDescriptorPro
|
|||||||
ExtendedType: extendedType,
|
ExtendedType: extendedType,
|
||||||
ExtensionType: extensionType,
|
ExtensionType: extensionType,
|
||||||
Field: fieldID,
|
Field: fieldID,
|
||||||
Tag: fmt.Sprintf("varint,%d", fieldID),
|
Tag: fmt.Sprintf("bytes,%d", fieldID),
|
||||||
}
|
}
|
||||||
proto.RegisterExtension(ed)
|
proto.RegisterExtension(ed)
|
||||||
eds = proto.RegisteredExtensions(f.Options)
|
eds = proto.RegisteredExtensions(f.Options)
|
||||||
@@ -599,41 +447,6 @@ func boolFieldExtension(fieldID int32, f *descriptor.FieldDescriptorProto) bool
|
|||||||
return *b
|
return *b
|
||||||
}
|
}
|
||||||
|
|
||||||
func boolMessageExtension(fieldID int32, f *descriptor.DescriptorProto) bool {
|
|
||||||
if f == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if f.Options == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
var extendedType *descriptor.MessageOptions
|
|
||||||
var extensionType *bool
|
|
||||||
|
|
||||||
eds := proto.RegisteredExtensions(f.Options)
|
|
||||||
if eds[fieldID] == nil {
|
|
||||||
ed := &proto.ExtensionDesc{
|
|
||||||
ExtendedType: extendedType,
|
|
||||||
ExtensionType: extensionType,
|
|
||||||
Field: fieldID,
|
|
||||||
Tag: fmt.Sprintf("varint,%d", fieldID),
|
|
||||||
}
|
|
||||||
proto.RegisterExtension(ed)
|
|
||||||
eds = proto.RegisteredExtensions(f.Options)
|
|
||||||
}
|
|
||||||
|
|
||||||
ext, err := proto.GetExtension(f.Options, eds[fieldID])
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
b, ok := ext.(*bool)
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return *b
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
for k, v := range sprig.TxtFuncMap() {
|
for k, v := range sprig.TxtFuncMap() {
|
||||||
ProtoHelpersFuncMap[k] = v
|
ProtoHelpersFuncMap[k] = v
|
||||||
@@ -1315,13 +1128,3 @@ func replaceDict(src string, dict map[string]interface{}) string {
|
|||||||
}
|
}
|
||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
|
|
||||||
func goPkg(f *descriptor.FileDescriptorProto) string {
|
|
||||||
return f.Options.GetGoPackage()
|
|
||||||
}
|
|
||||||
|
|
||||||
func goPkgLastElement(f *descriptor.FileDescriptorProto) string {
|
|
||||||
pkg := goPkg(f)
|
|
||||||
pkgSplitted := strings.Split(pkg, "/")
|
|
||||||
return pkgSplitted[len(pkgSplitted)-1]
|
|
||||||
}
|
|
||||||
|
22
main.go
22
main.go
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/golang/protobuf/protoc-gen-go/generator"
|
"github.com/golang/protobuf/protoc-gen-go/generator"
|
||||||
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
|
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
||||||
ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
|
ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
|
||||||
|
|
||||||
pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
|
pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
|
||||||
@@ -48,7 +48,6 @@ func main() {
|
|||||||
debug = false
|
debug = false
|
||||||
all = false
|
all = false
|
||||||
singlePackageMode = false
|
singlePackageMode = false
|
||||||
fileMode = false
|
|
||||||
)
|
)
|
||||||
if parameter := g.Request.GetParameter(); parameter != "" {
|
if parameter := g.Request.GetParameter(); parameter != "" {
|
||||||
for _, param := range strings.Split(parameter, ",") {
|
for _, param := range strings.Split(parameter, ",") {
|
||||||
@@ -86,14 +85,6 @@ func main() {
|
|||||||
default:
|
default:
|
||||||
log.Printf("Err: invalid value for debug: %q", parts[1])
|
log.Printf("Err: invalid value for debug: %q", parts[1])
|
||||||
}
|
}
|
||||||
case "file-mode":
|
|
||||||
switch strings.ToLower(parts[1]) {
|
|
||||||
case boolTrue, "t":
|
|
||||||
fileMode = true
|
|
||||||
case boolFalse, "f":
|
|
||||||
default:
|
|
||||||
log.Printf("Err: invalid value for file-mode: %q", parts[1])
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
log.Printf("Err: unknown parameter: %q", param)
|
log.Printf("Err: unknown parameter: %q", param)
|
||||||
}
|
}
|
||||||
@@ -134,17 +125,6 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileMode {
|
|
||||||
if s := file.GetService(); s != nil && len(s) > 0 {
|
|
||||||
encoder := NewGenericTemplateBasedEncoder(templateDir, file, debug, destinationDir)
|
|
||||||
for _, tmpl := range encoder.Files() {
|
|
||||||
concatOrAppend(tmpl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, service := range file.GetService() {
|
for _, service := range file.GetService() {
|
||||||
encoder := NewGenericServiceTemplateBasedEncoder(templateDir, service, file, debug, destinationDir)
|
encoder := NewGenericServiceTemplateBasedEncoder(templateDir, service, file, debug, destinationDir)
|
||||||
for _, tmpl := range encoder.Files() {
|
for _, tmpl := range encoder.Files() {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"config:base"
|
"config:base"
|
||||||
],
|
]
|
||||||
"groupName": "all"
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user