Skip to content

Commit ff3786c

Browse files
authored
Fix // Deprecated: comments for @deprecated annotations (#88)
* Fix Deprecated: comments @deprecated @deprecated:"Use MethodV2 instead." * Fix example
1 parent 4383314 commit ff3786c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

_examples/golang-basics/example.gen.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types.go.tmpl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ var WebRPCServices = map[string][]string{
6868
{{ if $opts.types -}}
6969
type {{$service.Name}} interface {
7070
{{- range $_, $method := $service.Methods}}
71+
{{- $deprecated := index $method.Annotations "deprecated" -}}
7172
{{- if gt (len $method.Comments) 0 -}}
7273
{{- range $_, $comment := $method.Comments }}
7374
// {{ replaceAll $comment "\"" "'" }}
7475
{{- end }}
76+
{{- if $deprecated }}
77+
//
78+
{{- end }}
7579
{{- end }}
76-
{{- $deprecated := index $method.Annotations "deprecated" -}}
7780
{{- if $deprecated }}
78-
// Deprecated:
81+
// Deprecated: {{ $deprecated.Value }}
7982
{{- end }}
8083
{{ if eq $method.StreamOutput true -}}
8184
{{$method.Name}}(ctx context.Context{{range $_, $input := $method.Inputs}}, {{$input.Name}} {{template "field" dict "Name" $input.Name "Type" $input.Type "TypeMap" $typeMap "TypePrefix" $typePrefix "Optional" $input.Optional "TypeMeta" $input.Meta}}{{end}}, stream {{$method.Name}}StreamWriter) error
@@ -174,14 +177,17 @@ func (w *streamWriter) write(respPayload interface{}) error {
174177
{{ range $_, $service := $services -}}
175178
type {{$service.Name}}Client interface {
176179
{{- range $_, $method := $service.Methods}}
180+
{{- $deprecated := index $method.Annotations "deprecated" -}}
177181
{{- if gt (len $method.Comments) 0 }}
178182
{{- range $_, $comment := $method.Comments }}
179183
// {{ replaceAll $comment "\"" "'" }}
180184
{{- end }}
185+
{{- if $deprecated }}
186+
//
187+
{{- end }}
181188
{{- end }}
182-
{{- $deprecated := index $method.Annotations "deprecated" -}}
183189
{{- if $deprecated }}
184-
// Deprecated:
190+
// Deprecated: {{ $deprecated.Value }}
185191
{{- end }}
186192
{{ if eq $method.StreamOutput true -}}
187193
{{$method.Name}}(ctx context.Context{{range $_, $input := $method.Inputs}}, {{$input.Name}} {{template "field" dict "Name" $input.Name "Type" $input.Type "TypeMap" $typeMap "TypePrefix" $typePrefix "Optional" $input.Optional "TypeMeta" $input.Meta}}{{end}}) ({{$method.Name}}StreamReader, error)

0 commit comments

Comments
 (0)