moul / protoc-gen-gotemplate

:open_file_folder: generic protocol generator based on golang's text/template (grpc/protobuf)
https://manfred.life/protoc-gen-gotemplate
MIT License
438 stars 70 forks source link

splitArray | last doesn't work in online demo #145

Open asad-awadia opened 5 years ago

asad-awadia commented 5 years ago

http://protoc-gen-gotemplate.m.42.am/

// here request.(*pb.{{.InputType | splitArray "." | last }}) doing this gives

2019/08/04 15:46:10 new encoder: file="example.proto" service="RouteGuide" template-dir="/tmp/pggt313081003"
2019/08/04 15:46:10 new template: "example.output.tmpl"
panic: template: example.output.tmpl:27:53: executing "example.output.tmpl" at <last>: wrong type for value; expected []interface {}; got []string

goroutine 1 [running]:
main.(*GenericTemplateBasedEncoder).Files(0xc420015a40, 0x12, 0xc42005dc00, 0xc420162000)
    /go/src/github.com/moul/protoc-gen-gotemplate/encoder.go:194 +0x4f1
main.main()
    /go/src/github.com/moul/protoc-gen-gotemplate/main.go:130 +0x3e0
--gotemplate_out: protoc-gen-gotemplate: Plugin failed with status code 2.
asad-awadia commented 5 years ago

@moul