Merge pull request #64 from moul/dev/moul/fix-urls-vars-from-message

Make urlHasVarsFromMessage consistent with getMessageType
This commit is contained in:
Manfred Touron 2017-05-19 20:13:42 +02:00 committed by GitHub
commit 098b247649
3 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"build-date": "2017-05-02T11:50:25.063291628+02:00", "build-date": "2017-05-19T20:09:45.954357761+02:00",
"build-hostname": "manfred-spacegray.local", "build-hostname": "manfred-spacegray.aircard",
"build-user": "moul", "build-user": "moul",
"pwd": "/Users/moul/Git/moul/protoc-gen-gotemplate/examples/dummy", "pwd": "/Users/moul/Git/moul/protoc-gen-gotemplate/examples/dummy",
"debug": false, "debug": false,
@ -839,5 +839,6 @@
"options": {} "options": {}
} }
] ]
} },
"enum": null
} }

View File

@ -4,18 +4,18 @@
<loc>/posts</loc> <loc>/posts</loc>
<priority>0.5</priority> <priority>0.5</priority>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<lastmod>2017-03-31</lastmod> <lastmod>2017-05-19</lastmod>
</url> </url>
<url> <url>
<loc>/authors</loc> <loc>/authors</loc>
<priority>0.5</priority> <priority>0.5</priority>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<lastmod>2017-03-31</lastmod> <lastmod>2017-05-19</lastmod>
</url> </url>
<url> <url>
<loc>/comments</loc> <loc>/comments</loc>
<priority>0.5</priority> <priority>0.5</priority>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<lastmod>2017-03-31</lastmod> <lastmod>2017-05-19</lastmod>
</url> </url>
</urlset> </urlset>

View File

@ -338,7 +338,7 @@ func httpVerb(m *descriptor.MethodDescriptorProto) string {
} }
} }
func urlHasVarsFromMessage(path string, d *descriptor.DescriptorProto) bool { func urlHasVarsFromMessage(path string, d *ggdescriptor.Message) bool {
for _, field := range d.Field { for _, field := range d.Field {
if !isFieldMessage(field) { if !isFieldMessage(field) {
if strings.Contains(path, fmt.Sprintf("{%s}", *field.Name)) { if strings.Contains(path, fmt.Sprintf("{%s}", *field.Name)) {