Repository: goadesign/goa
Pull request #3727 (2025-06-18 19:34:16)

Check for nil interceptors before wrapping
Wrap the endpoints with interceptors only when provided

raphael: Makes sense, thank you!

Patch:
diff --git a/codegen/service/templates/client_wrappers.go.tpl b/codegen/service/templates/client_wrappers.go.tpl
index 711e632e..bbd1a551 100644
--- a/codegen/service/templates/client_wrappers.go.tpl
+++ b/codegen/service/templates/client_wrappers.go.tpl
@@ -1,8 +1,10 @@
 
 {{ comment (printf "Wrap%sClientEndpoint wraps the %s endpoint with the client interceptors defined in the design." .MethodVarName .Method) }}
 func Wrap{{ .MethodVarName }}ClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	{{- range .Interceptors }}
-	endpoint = wrapClient{{ $.MethodVarName }}{{ . }}(endpoint, i)
-	{{- end }}
+	if i != nil {
+		{{- range .Interceptors }}
+		endpoint = wrapClient{{ $.MethodVarName }}{{ . }}(endpoint, i)
+		{{- end }}
+	}
 	return endpoint
 }
diff --git a/codegen/service/templates/endpoint_wrappers.go.tpl b/codegen/service/templates/endpoint_wrappers.go.tpl
index deffd14f..fee83a87 100644
--- a/codegen/service/templates/endpoint_wrappers.go.tpl
+++ b/codegen/service/templates/endpoint_wrappers.go.tpl
@@ -1,7 +1,9 @@
 {{ comment (printf "Wrap%sEndpoint wraps the %s endpoint with the server-side interceptors defined in the design." .MethodVarName .Method) }}
 func Wrap{{ .MethodVarName }}Endpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	{{- range .Interceptors }}
-	endpoint = wrap{{ $.MethodVarName }}{{ . }}(endpoint, i)
-	{{- end }}
+	if i != nil {
+		{{- range .Interceptors }}
+		endpoint = wrap{{ $.MethodVarName }}{{ . }}(endpoint, i)
+		{{- end }}
+	}
 	return endpoint
 }


Test patch:
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-payload_client_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-payload_client_interceptors.go.golden
index 5b21e6d3..c55718e9 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-payload_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-payload_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodvalidation(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodvalidation(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-payload_service_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-payload_service_interceptors.go.golden
index 3acc1de9..8510ebab 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-payload_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-payload_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodvalidation(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodvalidation(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-result_client_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-result_client_interceptors.go.golden
index 7bf02718..eb23fdc5 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-result_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-result_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodcaching(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodcaching(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-result_service_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-result_service_interceptors.go.golden
index acbf42db..07c3c5c8 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-result_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-result_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodcaching(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodcaching(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_client_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_client_interceptors.go.golden
index 5b21e6d3..c55718e9 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodvalidation(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodvalidation(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_service_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_service_interceptors.go.golden
index 424a6974..1e77d5d8 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-write-payload_service_interceptors.go.golden
@@ -36,7 +36,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodvalidation(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodvalidation(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-write-result_client_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-write-result_client_interceptors.go.golden
index 7bf02718..eb23fdc5 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-write-result_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-write-result_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodcaching(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodcaching(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/interceptor-with-read-write-result_service_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-read-write-result_service_interceptors.go.golden
index cebda374..5457dfda 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-read-write-result_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-read-write-result_service_interceptors.go.golden
@@ -36,7 +36,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodcaching(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodcaching(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/interceptor-with-write-payload_client_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-write-payload_client_interceptors.go.golden
index 5b21e6d3..c55718e9 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-write-payload_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-write-payload_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodvalidation(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodvalidation(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/interceptor-with-write-payload_service_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-write-payload_service_interceptors.go.golden
index e9b7d863..c67700cd 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-write-payload_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-write-payload_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodvalidation(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodvalidation(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/interceptor-with-write-result_client_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-write-result_client_interceptors.go.golden
index 7bf02718..eb23fdc5 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-write-result_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-write-result_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodcaching(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodcaching(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/interceptor-with-write-result_service_interceptors.go.golden b/codegen/service/testdata/interceptors/interceptor-with-write-result_service_interceptors.go.golden
index 161c5e8a..0e7844bb 100644
--- a/codegen/service/testdata/interceptors/interceptor-with-write-result_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/interceptor-with-write-result_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodcaching(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodcaching(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/multiple-interceptors_client_interceptors.go.golden b/codegen/service/testdata/interceptors/multiple-interceptors_client_interceptors.go.golden
index 5723a587..449f55aa 100644
--- a/codegen/service/testdata/interceptors/multiple-interceptors_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/multiple-interceptors_client_interceptors.go.golden
@@ -30,8 +30,10 @@ type (
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodtest2(endpoint, i)
-	endpoint = wrapClientMethodtest4(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodtest2(endpoint, i)
+		endpoint = wrapClientMethodtest4(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/multiple-interceptors_service_interceptors.go.golden b/codegen/service/testdata/interceptors/multiple-interceptors_service_interceptors.go.golden
index e3bbd8b0..46327a5a 100644
--- a/codegen/service/testdata/interceptors/multiple-interceptors_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/multiple-interceptors_service_interceptors.go.golden
@@ -30,8 +30,10 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodtest(endpoint, i)
-	endpoint = wrapMethodtest3(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodtest(endpoint, i)
+		endpoint = wrapMethodtest3(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/single-api-server-interceptor_service_interceptors.go.golden b/codegen/service/testdata/interceptors/single-api-server-interceptor_service_interceptors.go.golden
index cc412733..4e28b05e 100644
--- a/codegen/service/testdata/interceptors/single-api-server-interceptor_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/single-api-server-interceptor_service_interceptors.go.golden
@@ -21,14 +21,18 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
 // WrapMethod2Endpoint wraps the Method2 endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethod2Endpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethod2logging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethod2logging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/single-client-interceptor_client_interceptors.go.golden b/codegen/service/testdata/interceptors/single-client-interceptor_client_interceptors.go.golden
index 0bd0e33e..8bc74da5 100644
--- a/codegen/service/testdata/interceptors/single-client-interceptor_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/single-client-interceptor_client_interceptors.go.golden
@@ -21,7 +21,9 @@ type (
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodtracing(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodtracing(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/single-method-server-interceptor_service_interceptors.go.golden b/codegen/service/testdata/interceptors/single-method-server-interceptor_service_interceptors.go.golden
index f3965db8..73b53038 100644
--- a/codegen/service/testdata/interceptors/single-method-server-interceptor_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/single-method-server-interceptor_service_interceptors.go.golden
@@ -21,7 +21,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/single-service-server-interceptor_service_interceptors.go.golden b/codegen/service/testdata/interceptors/single-service-server-interceptor_service_interceptors.go.golden
index cc412733..4e28b05e 100644
--- a/codegen/service/testdata/interceptors/single-service-server-interceptor_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/single-service-server-interceptor_service_interceptors.go.golden
@@ -21,14 +21,18 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
 // WrapMethod2Endpoint wraps the Method2 endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethod2Endpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethod2logging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethod2logging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_client_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_client_interceptors.go.golden
index 3790fd8c..46dd4655 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_service_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_service_interceptors.go.golden
index 8ac3e355..47a6372e 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload-and-read-streaming-payload_service_interceptors.go.golden
@@ -45,7 +45,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload_service_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload_service_interceptors.go.golden
index 3ca17e60..031813f3 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-payload_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-result_service_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-result_service_interceptors.go.golden
index 3bbb27f3..e1b86b82 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-result_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-result_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_client_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_client_interceptors.go.golden
index 3790fd8c..46dd4655 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_service_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_service_interceptors.go.golden
index c074c15c..af6d942f 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors-with-read-streaming-result_service_interceptors.go.golden
@@ -35,7 +35,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
 
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors_client_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors_client_interceptors.go.golden
index 3790fd8c..46dd4655 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors_client_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors_client_interceptors.go.golden
@@ -9,6 +9,8 @@ type ClientInterceptors interface {
 // WrapMethodClientEndpoint wraps the Method endpoint with the client
 // interceptors defined in the design.
 func WrapMethodClientEndpoint(endpoint goa.Endpoint, i ClientInterceptors) goa.Endpoint {
-	endpoint = wrapClientMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapClientMethodlogging(endpoint, i)
+	}
 	return endpoint
 }
diff --git a/codegen/service/testdata/interceptors/streaming-interceptors_service_interceptors.go.golden b/codegen/service/testdata/interceptors/streaming-interceptors_service_interceptors.go.golden
index 3424b0a6..da2e8aa5 100644
--- a/codegen/service/testdata/interceptors/streaming-interceptors_service_interceptors.go.golden
+++ b/codegen/service/testdata/interceptors/streaming-interceptors_service_interceptors.go.golden
@@ -47,7 +47,9 @@ type (
 // WrapMethodEndpoint wraps the Method endpoint with the server-side
 // interceptors defined in the design.
 func WrapMethodEndpoint(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
-	endpoint = wrapMethodlogging(endpoint, i)
+	if i != nil {
+		endpoint = wrapMethodlogging(endpoint, i)
+	}
 	return endpoint
 }