ci: fix all linter errors found in golangci-lint

Fixing all the linter errors found in golang-ci
lint v1.46.2

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-06-01 15:47:19 +05:30
committed by mergify[bot]
parent 9e5cad173d
commit 1952a9b4b3
56 changed files with 348 additions and 195 deletions

View File

@ -173,7 +173,8 @@ func contextIDInjector(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler) (resp interface{}, err error) {
handler grpc.UnaryHandler,
) (interface{}, error) {
atomic.AddUint64(&id, 1)
ctx = context.WithValue(ctx, log.CtxKey, id)
if reqID := getReqID(req); reqID != "" {
@ -187,7 +188,8 @@ func logGRPC(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler) (interface{}, error) {
handler grpc.UnaryHandler,
) (interface{}, error) {
log.ExtendedLog(ctx, "GRPC call: %s", info.FullMethod)
if isReplicationRequest(req) {
log.TraceLog(ctx, "GRPC request: %s", rp.StripReplicationSecrets(req))
@ -205,11 +207,13 @@ func logGRPC(
return resp, err
}
//nolint:nonamedreturns // named return used to send recovered panic error.
func panicHandler(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler) (resp interface{}, err error) {
handler grpc.UnaryHandler,
) (resp interface{}, err error) {
defer func() {
if r := recover(); r != nil {
klog.Errorf("panic occurred: %v", r)