chore: golangci-lint update.

This commit is contained in:
Xavier Michelon
2024-07-11 11:14:23 +02:00
parent 5d3f084a2b
commit fc64dbec59
33 changed files with 157 additions and 158 deletions

View File

@ -581,7 +581,7 @@ func validateServerToken(ctx context.Context, wantToken string) error {
// newUnaryTokenValidator checks the server token for every unary gRPC call.
func newUnaryTokenValidator(wantToken string) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
if err := validateServerToken(ctx, wantToken); err != nil {
return nil, err
}
@ -592,7 +592,7 @@ func newUnaryTokenValidator(wantToken string) grpc.UnaryServerInterceptor {
// newStreamTokenValidator checks the server token for every gRPC stream request.
func newStreamTokenValidator(wantToken string) grpc.StreamServerInterceptor {
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
return func(srv interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
if err := validateServerToken(stream.Context(), wantToken); err != nil {
return err
}
@ -626,9 +626,7 @@ func (s *Service) monitorParentPID() {
go func() {
defer async.HandlePanic(s.panicHandler)
if err := s.quit(); err != nil {
logrus.WithError(err).Error("Error on quit")
}
s.quit()
}()
}

View File

@ -110,10 +110,11 @@ func (s *Service) GuiReady(_ context.Context, _ *emptypb.Empty) (*GuiReadyRespon
func (s *Service) Quit(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
defer async.HandlePanic(s.panicHandler)
s.log.Debug("Quit")
return &emptypb.Empty{}, s.quit()
s.quit()
return &emptypb.Empty{}, nil
}
func (s *Service) quit() error {
func (s *Service) quit() {
// Windows is notably slow at Quitting. We do it in a goroutine to speed things up a bit.
go func() {
defer async.HandlePanic(s.panicHandler)
@ -132,8 +133,6 @@ func (s *Service) quit() error {
// The following call is launched as a goroutine, as it will wait for current calls to end, including this one.
s.grpcServer.GracefulStop() // gRPC does clean up and remove the file socket if used.
}()
return nil
}
// Restart implement the Restart gRPC service call.

View File

@ -76,7 +76,8 @@ func (s *Service) RunEventStream(request *EventStreamRequest, server Bridge_RunE
}
case <-server.Context().Done():
s.log.Debug("Client closed the stream, exiting")
return s.quit()
s.quit()
return nil
}
}
}