Skip to content

Commit

Permalink
Improve generated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael committed Nov 26, 2024
1 parent 02a856d commit 879a0fe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions codegen/service/interceptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type (
// InterceptorData describes a single interceptor.
InterceptorData struct {
Name string
DesignName string
UnexportedName string
Description string
PayloadRef string
Expand Down Expand Up @@ -150,6 +151,7 @@ func buildMethodInterceptors(m *expr.MethodExpr, scope *codegen.NameScope) ([]*I

return &InterceptorData{
Name: codegen.Goify(intr.Name, true),
DesignName: intr.Name,
UnexportedName: codegen.Goify(intr.Name, false),
Description: intr.Description,
PayloadRef: methodData.PayloadRef,
Expand Down
2 changes: 1 addition & 1 deletion codegen/service/templates/client_wrappers.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ func Wrap{{ .MethodVarName }}ClientEndpoint(endpoint goa.Endpoint, i ClientInter
}

{{- range .ClientInterceptors }}
{{ comment (printf "wrapClient%s applies the %s interceptor to endpoints." .Name .Name) }}
{{ comment (printf "wrapClient%s applies the %s interceptor to endpoints." .Name .DesignName) }}
func wrapClient{{ .Name }}(endpoint goa.Endpoint, i ClientInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &{{ .Name }}Info{
Expand Down
2 changes: 1 addition & 1 deletion codegen/service/templates/endpoint_wrappers.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ func Wrap{{ .MethodVarName }}Endpoint(endpoint goa.Endpoint, i ServerInterceptor
}

{{- range .ServerInterceptors }}
{{ comment (printf "wrap%s applies the %s interceptor to endpoints." .Name .Name) }}
{{ comment (printf "wrap%s applies the %s interceptor to endpoints." .Name .DesignName) }}
func wrap{{ .Name }}(endpoint goa.Endpoint, i ServerInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &{{ .Name }}Info{
Expand Down
2 changes: 1 addition & 1 deletion codegen/service/testdata/client_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.E
return endpoint
}
// wrapClientTracing applies the Tracing interceptor to endpoints.
// wrapClientTracing applies the tracing interceptor to endpoints.
func wrapClientTracing(endpoint goa.Endpoint, i ClientInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &TracingInfo{
Expand Down
8 changes: 4 additions & 4 deletions codegen/service/testdata/endpoint_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoin
return endpoint
}
// wrapLogging applies the Logging interceptor to endpoints.
// wrapLogging applies the logging interceptor to endpoints.
func wrapLogging(endpoint goa.Endpoint, i ServerInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &LoggingInfo{
Expand Down Expand Up @@ -605,7 +605,7 @@ func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoin
return endpoint
}
// wrapLogging applies the Logging interceptor to endpoints.
// wrapLogging applies the logging interceptor to endpoints.
func wrapLogging(endpoint goa.Endpoint, i ServerInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &LoggingInfo{
Expand All @@ -621,7 +621,7 @@ func wrapLogging(endpoint goa.Endpoint, i ServerInterceptors, method string) goa
}
}
// wrapMetrics applies the Metrics interceptor to endpoints.
// wrapMetrics applies the metrics interceptor to endpoints.
func wrapMetrics(endpoint goa.Endpoint, i ServerInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &MetricsInfo{
Expand Down Expand Up @@ -679,7 +679,7 @@ func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoin
return endpoint
}
// wrapLogging applies the Logging interceptor to endpoints.
// wrapLogging applies the logging interceptor to endpoints.
func wrapLogging(endpoint goa.Endpoint, i ServerInterceptors, method string) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
info := &LoggingInfo{
Expand Down

0 comments on commit 879a0fe

Please sign in to comment.