diff --git a/proto/gen/api/v1/activity_service.pb.gw.go b/proto/gen/api/v1/activity_service.pb.gw.go index df2d3b81..7f03e4e9 100644 --- a/proto/gen/api/v1/activity_service.pb.gw.go +++ b/proto/gen/api/v1/activity_service.pb.gw.go @@ -87,6 +87,7 @@ func local_request_ActivityService_GetActivity_0(ctx context.Context, marshaler // UnaryRPC :call ActivityServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterActivityServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterActivityServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ActivityServiceServer) error { mux.Handle("GET", pattern_ActivityService_GetActivity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -152,7 +153,7 @@ func RegisterActivityServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ActivityServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ActivityServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ActivityServiceClient" to call the correct interceptors. +// "ActivityServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterActivityServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ActivityServiceClient) error { mux.Handle("GET", pattern_ActivityService_GetActivity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/activity_service_grpc.pb.go b/proto/gen/api/v1/activity_service_grpc.pb.go index c6eff39d..787ac80b 100644 --- a/proto/gen/api/v1/activity_service_grpc.pb.go +++ b/proto/gen/api/v1/activity_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/activity_service.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ActivityService_GetActivity_FullMethodName = "/memos.api.v1.ActivityService/GetActivity" @@ -50,21 +50,25 @@ func (c *activityServiceClient) GetActivity(ctx context.Context, in *GetActivity // ActivityServiceServer is the server API for ActivityService service. // All implementations must embed UnimplementedActivityServiceServer -// for forward compatibility +// for forward compatibility. type ActivityServiceServer interface { // GetActivity returns the activity with the given id. GetActivity(context.Context, *GetActivityRequest) (*Activity, error) mustEmbedUnimplementedActivityServiceServer() } -// UnimplementedActivityServiceServer must be embedded to have forward compatible implementations. -type UnimplementedActivityServiceServer struct { -} +// UnimplementedActivityServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedActivityServiceServer struct{} func (UnimplementedActivityServiceServer) GetActivity(context.Context, *GetActivityRequest) (*Activity, error) { return nil, status.Errorf(codes.Unimplemented, "method GetActivity not implemented") } func (UnimplementedActivityServiceServer) mustEmbedUnimplementedActivityServiceServer() {} +func (UnimplementedActivityServiceServer) testEmbeddedByValue() {} // UnsafeActivityServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ActivityServiceServer will @@ -74,6 +78,13 @@ type UnsafeActivityServiceServer interface { } func RegisterActivityServiceServer(s grpc.ServiceRegistrar, srv ActivityServiceServer) { + // If the following call pancis, it indicates UnimplementedActivityServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&ActivityService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/auth_service.pb.gw.go b/proto/gen/api/v1/auth_service.pb.gw.go index 5690b32f..07d8c8c7 100644 --- a/proto/gen/api/v1/auth_service.pb.gw.go +++ b/proto/gen/api/v1/auth_service.pb.gw.go @@ -179,6 +179,7 @@ func local_request_AuthService_SignOut_0(ctx context.Context, marshaler runtime. // UnaryRPC :call AuthServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error { mux.Handle("POST", pattern_AuthService_GetAuthStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -344,7 +345,7 @@ func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AuthServiceClient" to call the correct interceptors. +// "AuthServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error { mux.Handle("POST", pattern_AuthService_GetAuthStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/auth_service_grpc.pb.go b/proto/gen/api/v1/auth_service_grpc.pb.go index e722e150..f270198e 100644 --- a/proto/gen/api/v1/auth_service_grpc.pb.go +++ b/proto/gen/api/v1/auth_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/auth_service.proto @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AuthService_GetAuthStatus_FullMethodName = "/memos.api.v1.AuthService/GetAuthStatus" @@ -103,7 +103,7 @@ func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opt // AuthServiceServer is the server API for AuthService service. // All implementations must embed UnimplementedAuthServiceServer -// for forward compatibility +// for forward compatibility. type AuthServiceServer interface { // GetAuthStatus returns the current auth status of the user. GetAuthStatus(context.Context, *GetAuthStatusRequest) (*User, error) @@ -118,9 +118,12 @@ type AuthServiceServer interface { mustEmbedUnimplementedAuthServiceServer() } -// UnimplementedAuthServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAuthServiceServer struct { -} +// UnimplementedAuthServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAuthServiceServer struct{} func (UnimplementedAuthServiceServer) GetAuthStatus(context.Context, *GetAuthStatusRequest) (*User, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAuthStatus not implemented") @@ -138,6 +141,7 @@ func (UnimplementedAuthServiceServer) SignOut(context.Context, *SignOutRequest) return nil, status.Errorf(codes.Unimplemented, "method SignOut not implemented") } func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} +func (UnimplementedAuthServiceServer) testEmbeddedByValue() {} // UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AuthServiceServer will @@ -147,6 +151,13 @@ type UnsafeAuthServiceServer interface { } func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + // If the following call pancis, it indicates UnimplementedAuthServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&AuthService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/idp_service.pb.gw.go b/proto/gen/api/v1/idp_service.pb.gw.go index 973dd0de..c18da517 100644 --- a/proto/gen/api/v1/idp_service.pb.gw.go +++ b/proto/gen/api/v1/idp_service.pb.gw.go @@ -283,6 +283,7 @@ func local_request_IdentityProviderService_DeleteIdentityProvider_0(ctx context. // UnaryRPC :call IdentityProviderServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterIdentityProviderServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server IdentityProviderServiceServer) error { mux.Handle("GET", pattern_IdentityProviderService_ListIdentityProviders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -448,7 +449,7 @@ func RegisterIdentityProviderServiceHandler(ctx context.Context, mux *runtime.Se // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "IdentityProviderServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "IdentityProviderServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "IdentityProviderServiceClient" to call the correct interceptors. +// "IdentityProviderServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client IdentityProviderServiceClient) error { mux.Handle("GET", pattern_IdentityProviderService_ListIdentityProviders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/idp_service_grpc.pb.go b/proto/gen/api/v1/idp_service_grpc.pb.go index 93195670..3a9bee2e 100644 --- a/proto/gen/api/v1/idp_service_grpc.pb.go +++ b/proto/gen/api/v1/idp_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/idp_service.proto @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( IdentityProviderService_ListIdentityProviders_FullMethodName = "/memos.api.v1.IdentityProviderService/ListIdentityProviders" @@ -103,7 +103,7 @@ func (c *identityProviderServiceClient) DeleteIdentityProvider(ctx context.Conte // IdentityProviderServiceServer is the server API for IdentityProviderService service. // All implementations must embed UnimplementedIdentityProviderServiceServer -// for forward compatibility +// for forward compatibility. type IdentityProviderServiceServer interface { // ListIdentityProviders lists identity providers. ListIdentityProviders(context.Context, *ListIdentityProvidersRequest) (*ListIdentityProvidersResponse, error) @@ -118,9 +118,12 @@ type IdentityProviderServiceServer interface { mustEmbedUnimplementedIdentityProviderServiceServer() } -// UnimplementedIdentityProviderServiceServer must be embedded to have forward compatible implementations. -type UnimplementedIdentityProviderServiceServer struct { -} +// UnimplementedIdentityProviderServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedIdentityProviderServiceServer struct{} func (UnimplementedIdentityProviderServiceServer) ListIdentityProviders(context.Context, *ListIdentityProvidersRequest) (*ListIdentityProvidersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListIdentityProviders not implemented") @@ -139,6 +142,7 @@ func (UnimplementedIdentityProviderServiceServer) DeleteIdentityProvider(context } func (UnimplementedIdentityProviderServiceServer) mustEmbedUnimplementedIdentityProviderServiceServer() { } +func (UnimplementedIdentityProviderServiceServer) testEmbeddedByValue() {} // UnsafeIdentityProviderServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to IdentityProviderServiceServer will @@ -148,6 +152,13 @@ type UnsafeIdentityProviderServiceServer interface { } func RegisterIdentityProviderServiceServer(s grpc.ServiceRegistrar, srv IdentityProviderServiceServer) { + // If the following call pancis, it indicates UnimplementedIdentityProviderServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&IdentityProviderService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/inbox_service.pb.gw.go b/proto/gen/api/v1/inbox_service.pb.gw.go index 51e0b314..6cd88ae6 100644 --- a/proto/gen/api/v1/inbox_service.pb.gw.go +++ b/proto/gen/api/v1/inbox_service.pb.gw.go @@ -223,6 +223,7 @@ func local_request_InboxService_DeleteInbox_0(ctx context.Context, marshaler run // UnaryRPC :call InboxServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInboxServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InboxServiceServer) error { mux.Handle("GET", pattern_InboxService_ListInboxes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -338,7 +339,7 @@ func RegisterInboxServiceHandler(ctx context.Context, mux *runtime.ServeMux, con // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InboxServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InboxServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "InboxServiceClient" to call the correct interceptors. +// "InboxServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InboxServiceClient) error { mux.Handle("GET", pattern_InboxService_ListInboxes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/inbox_service_grpc.pb.go b/proto/gen/api/v1/inbox_service_grpc.pb.go index ebe756e9..d74a2625 100644 --- a/proto/gen/api/v1/inbox_service_grpc.pb.go +++ b/proto/gen/api/v1/inbox_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/inbox_service.proto @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( InboxService_ListInboxes_FullMethodName = "/memos.api.v1.InboxService/ListInboxes" @@ -77,7 +77,7 @@ func (c *inboxServiceClient) DeleteInbox(ctx context.Context, in *DeleteInboxReq // InboxServiceServer is the server API for InboxService service. // All implementations must embed UnimplementedInboxServiceServer -// for forward compatibility +// for forward compatibility. type InboxServiceServer interface { // ListInboxes lists inboxes for a user. ListInboxes(context.Context, *ListInboxesRequest) (*ListInboxesResponse, error) @@ -88,9 +88,12 @@ type InboxServiceServer interface { mustEmbedUnimplementedInboxServiceServer() } -// UnimplementedInboxServiceServer must be embedded to have forward compatible implementations. -type UnimplementedInboxServiceServer struct { -} +// UnimplementedInboxServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedInboxServiceServer struct{} func (UnimplementedInboxServiceServer) ListInboxes(context.Context, *ListInboxesRequest) (*ListInboxesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListInboxes not implemented") @@ -102,6 +105,7 @@ func (UnimplementedInboxServiceServer) DeleteInbox(context.Context, *DeleteInbox return nil, status.Errorf(codes.Unimplemented, "method DeleteInbox not implemented") } func (UnimplementedInboxServiceServer) mustEmbedUnimplementedInboxServiceServer() {} +func (UnimplementedInboxServiceServer) testEmbeddedByValue() {} // UnsafeInboxServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to InboxServiceServer will @@ -111,6 +115,13 @@ type UnsafeInboxServiceServer interface { } func RegisterInboxServiceServer(s grpc.ServiceRegistrar, srv InboxServiceServer) { + // If the following call pancis, it indicates UnimplementedInboxServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&InboxService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/markdown_service.pb.gw.go b/proto/gen/api/v1/markdown_service.pb.gw.go index bdd793b8..f95a4afd 100644 --- a/proto/gen/api/v1/markdown_service.pb.gw.go +++ b/proto/gen/api/v1/markdown_service.pb.gw.go @@ -149,6 +149,7 @@ func local_request_MarkdownService_GetLinkMetadata_0(ctx context.Context, marsha // UnaryRPC :call MarkdownServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMarkdownServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MarkdownServiceServer) error { mux.Handle("POST", pattern_MarkdownService_ParseMarkdown_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -289,7 +290,7 @@ func RegisterMarkdownServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MarkdownServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MarkdownServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "MarkdownServiceClient" to call the correct interceptors. +// "MarkdownServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MarkdownServiceClient) error { mux.Handle("POST", pattern_MarkdownService_ParseMarkdown_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/markdown_service_grpc.pb.go b/proto/gen/api/v1/markdown_service_grpc.pb.go index 24981b78..22bd0bdf 100644 --- a/proto/gen/api/v1/markdown_service_grpc.pb.go +++ b/proto/gen/api/v1/markdown_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/markdown_service.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( MarkdownService_ParseMarkdown_FullMethodName = "/memos.api.v1.MarkdownService/ParseMarkdown" @@ -89,7 +89,7 @@ func (c *markdownServiceClient) GetLinkMetadata(ctx context.Context, in *GetLink // MarkdownServiceServer is the server API for MarkdownService service. // All implementations must embed UnimplementedMarkdownServiceServer -// for forward compatibility +// for forward compatibility. type MarkdownServiceServer interface { // ParseMarkdown parses the given markdown content and returns a list of nodes. ParseMarkdown(context.Context, *ParseMarkdownRequest) (*ParseMarkdownResponse, error) @@ -102,9 +102,12 @@ type MarkdownServiceServer interface { mustEmbedUnimplementedMarkdownServiceServer() } -// UnimplementedMarkdownServiceServer must be embedded to have forward compatible implementations. -type UnimplementedMarkdownServiceServer struct { -} +// UnimplementedMarkdownServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMarkdownServiceServer struct{} func (UnimplementedMarkdownServiceServer) ParseMarkdown(context.Context, *ParseMarkdownRequest) (*ParseMarkdownResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ParseMarkdown not implemented") @@ -119,6 +122,7 @@ func (UnimplementedMarkdownServiceServer) GetLinkMetadata(context.Context, *GetL return nil, status.Errorf(codes.Unimplemented, "method GetLinkMetadata not implemented") } func (UnimplementedMarkdownServiceServer) mustEmbedUnimplementedMarkdownServiceServer() {} +func (UnimplementedMarkdownServiceServer) testEmbeddedByValue() {} // UnsafeMarkdownServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to MarkdownServiceServer will @@ -128,6 +132,13 @@ type UnsafeMarkdownServiceServer interface { } func RegisterMarkdownServiceServer(s grpc.ServiceRegistrar, srv MarkdownServiceServer) { + // If the following call pancis, it indicates UnimplementedMarkdownServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&MarkdownService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/memo_service.pb.gw.go b/proto/gen/api/v1/memo_service.pb.gw.go index dc227037..507e8c54 100644 --- a/proto/gen/api/v1/memo_service.pb.gw.go +++ b/proto/gen/api/v1/memo_service.pb.gw.go @@ -1211,6 +1211,7 @@ func local_request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshal // UnaryRPC :call MemoServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMemoServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MemoServiceServer) error { mux.Handle("POST", pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1776,7 +1777,7 @@ func RegisterMemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MemoServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MemoServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "MemoServiceClient" to call the correct interceptors. +// "MemoServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MemoServiceClient) error { mux.Handle("POST", pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/memo_service_grpc.pb.go b/proto/gen/api/v1/memo_service_grpc.pb.go index badbaa36..1298c5d8 100644 --- a/proto/gen/api/v1/memo_service_grpc.pb.go +++ b/proto/gen/api/v1/memo_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/memo_service.proto @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( MemoService_CreateMemo_FullMethodName = "/memos.api.v1.MemoService/CreateMemo" @@ -311,7 +311,7 @@ func (c *memoServiceClient) DeleteMemoReaction(ctx context.Context, in *DeleteMe // MemoServiceServer is the server API for MemoService service. // All implementations must embed UnimplementedMemoServiceServer -// for forward compatibility +// for forward compatibility. type MemoServiceServer interface { // CreateMemo creates a memo. CreateMemo(context.Context, *CreateMemoRequest) (*Memo, error) @@ -358,9 +358,12 @@ type MemoServiceServer interface { mustEmbedUnimplementedMemoServiceServer() } -// UnimplementedMemoServiceServer must be embedded to have forward compatible implementations. -type UnimplementedMemoServiceServer struct { -} +// UnimplementedMemoServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMemoServiceServer struct{} func (UnimplementedMemoServiceServer) CreateMemo(context.Context, *CreateMemoRequest) (*Memo, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateMemo not implemented") @@ -426,6 +429,7 @@ func (UnimplementedMemoServiceServer) DeleteMemoReaction(context.Context, *Delet return nil, status.Errorf(codes.Unimplemented, "method DeleteMemoReaction not implemented") } func (UnimplementedMemoServiceServer) mustEmbedUnimplementedMemoServiceServer() {} +func (UnimplementedMemoServiceServer) testEmbeddedByValue() {} // UnsafeMemoServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to MemoServiceServer will @@ -435,6 +439,13 @@ type UnsafeMemoServiceServer interface { } func RegisterMemoServiceServer(s grpc.ServiceRegistrar, srv MemoServiceServer) { + // If the following call pancis, it indicates UnimplementedMemoServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&MemoService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/resource_service.pb.gw.go b/proto/gen/api/v1/resource_service.pb.gw.go index 12e173f0..6eb4df9b 100644 --- a/proto/gen/api/v1/resource_service.pb.gw.go +++ b/proto/gen/api/v1/resource_service.pb.gw.go @@ -407,6 +407,7 @@ func local_request_ResourceService_DeleteResource_0(ctx context.Context, marshal // UnaryRPC :call ResourceServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterResourceServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterResourceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ResourceServiceServer) error { mux.Handle("POST", pattern_ResourceService_CreateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -622,7 +623,7 @@ func RegisterResourceServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ResourceServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ResourceServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ResourceServiceClient" to call the correct interceptors. +// "ResourceServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterResourceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ResourceServiceClient) error { mux.Handle("POST", pattern_ResourceService_CreateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/resource_service_grpc.pb.go b/proto/gen/api/v1/resource_service_grpc.pb.go index c719bd58..9090af87 100644 --- a/proto/gen/api/v1/resource_service_grpc.pb.go +++ b/proto/gen/api/v1/resource_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/resource_service.proto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ResourceService_CreateResource_FullMethodName = "/memos.api.v1.ResourceService/CreateResource" @@ -130,7 +130,7 @@ func (c *resourceServiceClient) DeleteResource(ctx context.Context, in *DeleteRe // ResourceServiceServer is the server API for ResourceService service. // All implementations must embed UnimplementedResourceServiceServer -// for forward compatibility +// for forward compatibility. type ResourceServiceServer interface { // CreateResource creates a new resource. CreateResource(context.Context, *CreateResourceRequest) (*Resource, error) @@ -149,9 +149,12 @@ type ResourceServiceServer interface { mustEmbedUnimplementedResourceServiceServer() } -// UnimplementedResourceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedResourceServiceServer struct { -} +// UnimplementedResourceServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedResourceServiceServer struct{} func (UnimplementedResourceServiceServer) CreateResource(context.Context, *CreateResourceRequest) (*Resource, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateResource not implemented") @@ -175,6 +178,7 @@ func (UnimplementedResourceServiceServer) DeleteResource(context.Context, *Delet return nil, status.Errorf(codes.Unimplemented, "method DeleteResource not implemented") } func (UnimplementedResourceServiceServer) mustEmbedUnimplementedResourceServiceServer() {} +func (UnimplementedResourceServiceServer) testEmbeddedByValue() {} // UnsafeResourceServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ResourceServiceServer will @@ -184,6 +188,13 @@ type UnsafeResourceServiceServer interface { } func RegisterResourceServiceServer(s grpc.ServiceRegistrar, srv ResourceServiceServer) { + // If the following call pancis, it indicates UnimplementedResourceServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&ResourceService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/user_service.pb.gw.go b/proto/gen/api/v1/user_service.pb.gw.go index 89e6d6d3..3ee36d4b 100644 --- a/proto/gen/api/v1/user_service.pb.gw.go +++ b/proto/gen/api/v1/user_service.pb.gw.go @@ -725,6 +725,7 @@ func local_request_UserService_DeleteUserAccessToken_0(ctx context.Context, mars // UnaryRPC :call UserServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error { mux.Handle("GET", pattern_UserService_ListUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1065,7 +1066,7 @@ func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "UserServiceClient" to call the correct interceptors. +// "UserServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error { mux.Handle("GET", pattern_UserService_ListUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/user_service_grpc.pb.go b/proto/gen/api/v1/user_service_grpc.pb.go index be7327e6..cdafa76a 100644 --- a/proto/gen/api/v1/user_service_grpc.pb.go +++ b/proto/gen/api/v1/user_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/user_service.proto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( UserService_ListUsers_FullMethodName = "/memos.api.v1.UserService/ListUsers" @@ -195,7 +195,7 @@ func (c *userServiceClient) DeleteUserAccessToken(ctx context.Context, in *Delet // UserServiceServer is the server API for UserService service. // All implementations must embed UnimplementedUserServiceServer -// for forward compatibility +// for forward compatibility. type UserServiceServer interface { // ListUsers returns a list of users. ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) @@ -224,9 +224,12 @@ type UserServiceServer interface { mustEmbedUnimplementedUserServiceServer() } -// UnimplementedUserServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUserServiceServer struct { -} +// UnimplementedUserServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedUserServiceServer struct{} func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented") @@ -265,6 +268,7 @@ func (UnimplementedUserServiceServer) DeleteUserAccessToken(context.Context, *De return nil, status.Errorf(codes.Unimplemented, "method DeleteUserAccessToken not implemented") } func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} +func (UnimplementedUserServiceServer) testEmbeddedByValue() {} // UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UserServiceServer will @@ -274,6 +278,13 @@ type UnsafeUserServiceServer interface { } func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + // If the following call pancis, it indicates UnimplementedUserServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&UserService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/webhook_service.pb.gw.go b/proto/gen/api/v1/webhook_service.pb.gw.go index bd8b960f..5fac7916 100644 --- a/proto/gen/api/v1/webhook_service.pb.gw.go +++ b/proto/gen/api/v1/webhook_service.pb.gw.go @@ -301,6 +301,7 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler // UnaryRPC :call WebhookServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWebhookServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WebhookServiceServer) error { mux.Handle("POST", pattern_WebhookService_CreateWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -466,7 +467,7 @@ func RegisterWebhookServiceHandler(ctx context.Context, mux *runtime.ServeMux, c // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WebhookServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WebhookServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "WebhookServiceClient" to call the correct interceptors. +// "WebhookServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WebhookServiceClient) error { mux.Handle("POST", pattern_WebhookService_CreateWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/webhook_service_grpc.pb.go b/proto/gen/api/v1/webhook_service_grpc.pb.go index 91c78d57..a700ff91 100644 --- a/proto/gen/api/v1/webhook_service_grpc.pb.go +++ b/proto/gen/api/v1/webhook_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/webhook_service.proto @@ -16,8 +16,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( WebhookService_CreateWebhook_FullMethodName = "/memos.api.v1.WebhookService/CreateWebhook" @@ -103,7 +103,7 @@ func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, in *DeleteWebh // WebhookServiceServer is the server API for WebhookService service. // All implementations must embed UnimplementedWebhookServiceServer -// for forward compatibility +// for forward compatibility. type WebhookServiceServer interface { // CreateWebhook creates a new webhook. CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) @@ -118,9 +118,12 @@ type WebhookServiceServer interface { mustEmbedUnimplementedWebhookServiceServer() } -// UnimplementedWebhookServiceServer must be embedded to have forward compatible implementations. -type UnimplementedWebhookServiceServer struct { -} +// UnimplementedWebhookServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWebhookServiceServer struct{} func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented") @@ -138,6 +141,7 @@ func (UnimplementedWebhookServiceServer) DeleteWebhook(context.Context, *DeleteW return nil, status.Errorf(codes.Unimplemented, "method DeleteWebhook not implemented") } func (UnimplementedWebhookServiceServer) mustEmbedUnimplementedWebhookServiceServer() {} +func (UnimplementedWebhookServiceServer) testEmbeddedByValue() {} // UnsafeWebhookServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WebhookServiceServer will @@ -147,6 +151,13 @@ type UnsafeWebhookServiceServer interface { } func RegisterWebhookServiceServer(s grpc.ServiceRegistrar, srv WebhookServiceServer) { + // If the following call pancis, it indicates UnimplementedWebhookServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&WebhookService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/workspace_service.pb.gw.go b/proto/gen/api/v1/workspace_service.pb.gw.go index 96a80d29..d2f6e7b5 100644 --- a/proto/gen/api/v1/workspace_service.pb.gw.go +++ b/proto/gen/api/v1/workspace_service.pb.gw.go @@ -53,6 +53,7 @@ func local_request_WorkspaceService_GetWorkspaceProfile_0(ctx context.Context, m // UnaryRPC :call WorkspaceServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWorkspaceServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceServiceServer) error { mux.Handle("GET", pattern_WorkspaceService_GetWorkspaceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -118,7 +119,7 @@ func RegisterWorkspaceServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkspaceServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkspaceServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "WorkspaceServiceClient" to call the correct interceptors. +// "WorkspaceServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceServiceClient) error { mux.Handle("GET", pattern_WorkspaceService_GetWorkspaceProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/workspace_service_grpc.pb.go b/proto/gen/api/v1/workspace_service_grpc.pb.go index c0baeab9..36ca9fbb 100644 --- a/proto/gen/api/v1/workspace_service_grpc.pb.go +++ b/proto/gen/api/v1/workspace_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/workspace_service.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( WorkspaceService_GetWorkspaceProfile_FullMethodName = "/memos.api.v1.WorkspaceService/GetWorkspaceProfile" @@ -50,21 +50,25 @@ func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *Ge // WorkspaceServiceServer is the server API for WorkspaceService service. // All implementations must embed UnimplementedWorkspaceServiceServer -// for forward compatibility +// for forward compatibility. type WorkspaceServiceServer interface { // GetWorkspaceProfile returns the workspace profile. GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error) mustEmbedUnimplementedWorkspaceServiceServer() } -// UnimplementedWorkspaceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedWorkspaceServiceServer struct { -} +// UnimplementedWorkspaceServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWorkspaceServiceServer struct{} func (UnimplementedWorkspaceServiceServer) GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error) { return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceProfile not implemented") } func (UnimplementedWorkspaceServiceServer) mustEmbedUnimplementedWorkspaceServiceServer() {} +func (UnimplementedWorkspaceServiceServer) testEmbeddedByValue() {} // UnsafeWorkspaceServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WorkspaceServiceServer will @@ -74,6 +78,13 @@ type UnsafeWorkspaceServiceServer interface { } func RegisterWorkspaceServiceServer(s grpc.ServiceRegistrar, srv WorkspaceServiceServer) { + // If the following call pancis, it indicates UnimplementedWorkspaceServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&WorkspaceService_ServiceDesc, srv) } diff --git a/proto/gen/api/v1/workspace_setting_service.pb.gw.go b/proto/gen/api/v1/workspace_setting_service.pb.gw.go index 9df10d8f..e6e8a5e6 100644 --- a/proto/gen/api/v1/workspace_setting_service.pb.gw.go +++ b/proto/gen/api/v1/workspace_setting_service.pb.gw.go @@ -147,6 +147,7 @@ func local_request_WorkspaceSettingService_SetWorkspaceSetting_0(ctx context.Con // UnaryRPC :call WorkspaceSettingServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWorkspaceSettingServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterWorkspaceSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceSettingServiceServer) error { mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -237,7 +238,7 @@ func RegisterWorkspaceSettingServiceHandler(ctx context.Context, mux *runtime.Se // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkspaceSettingServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkspaceSettingServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "WorkspaceSettingServiceClient" to call the correct interceptors. +// "WorkspaceSettingServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceSettingServiceClient) error { mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/gen/api/v1/workspace_setting_service_grpc.pb.go b/proto/gen/api/v1/workspace_setting_service_grpc.pb.go index 66990093..11df8071 100644 --- a/proto/gen/api/v1/workspace_setting_service_grpc.pb.go +++ b/proto/gen/api/v1/workspace_setting_service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: api/v1/workspace_setting_service.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( WorkspaceSettingService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting" @@ -63,7 +63,7 @@ func (c *workspaceSettingServiceClient) SetWorkspaceSetting(ctx context.Context, // WorkspaceSettingServiceServer is the server API for WorkspaceSettingService service. // All implementations must embed UnimplementedWorkspaceSettingServiceServer -// for forward compatibility +// for forward compatibility. type WorkspaceSettingServiceServer interface { // GetWorkspaceSetting returns the setting by name. GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) @@ -72,9 +72,12 @@ type WorkspaceSettingServiceServer interface { mustEmbedUnimplementedWorkspaceSettingServiceServer() } -// UnimplementedWorkspaceSettingServiceServer must be embedded to have forward compatible implementations. -type UnimplementedWorkspaceSettingServiceServer struct { -} +// UnimplementedWorkspaceSettingServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWorkspaceSettingServiceServer struct{} func (UnimplementedWorkspaceSettingServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) { return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented") @@ -84,6 +87,7 @@ func (UnimplementedWorkspaceSettingServiceServer) SetWorkspaceSetting(context.Co } func (UnimplementedWorkspaceSettingServiceServer) mustEmbedUnimplementedWorkspaceSettingServiceServer() { } +func (UnimplementedWorkspaceSettingServiceServer) testEmbeddedByValue() {} // UnsafeWorkspaceSettingServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WorkspaceSettingServiceServer will @@ -93,6 +97,13 @@ type UnsafeWorkspaceSettingServiceServer interface { } func RegisterWorkspaceSettingServiceServer(s grpc.ServiceRegistrar, srv WorkspaceSettingServiceServer) { + // If the following call pancis, it indicates UnimplementedWorkspaceSettingServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&WorkspaceSettingService_ServiceDesc, srv) }