Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
quzard committed Dec 15, 2023
1 parent 404317e commit 098424a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions helper/envconfig/aliyunlog_operation_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,11 @@ func (o *operationWrapper) createProductLogstore(config *AliyunLogConfigSpec, pr
annotations := GetAnnotationByObject(config, project, logstore, product, config.LogtailConfig.ConfigName, false)

if err != nil {
if k8s_event.GetEventRecorder() != nil {
customErr := CustomErrorFromPopError(err)
k8s_event.GetEventRecorder().SendErrorEventWithAnnotation(k8s_event.GetEventRecorder().GetObject(), GetAnnotationByError(annotations, customErr), k8s_event.CreateProductLogStore, "", fmt.Sprintf("create product log failed, error: %s", err.Error()))
}
customErr := CustomErrorFromPopError(err)
k8s_event.GetEventRecorder().SendErrorEventWithAnnotation(k8s_event.GetEventRecorder().GetObject(), GetAnnotationByError(annotations, customErr), k8s_event.CreateProductLogStore, "", fmt.Sprintf("create product log failed, error: %s", err.Error()))
logger.Warning(context.Background(), "CREATE_PRODUCT_ALARM", "create product error, error", err)
return err
} else if k8s_event.GetEventRecorder() != nil {
} else {

Check failure on line 209 in helper/envconfig/aliyunlog_operation_wrapper.go

View workflow job for this annotation

GitHub Actions / CI (1.19, ubuntu)

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
k8s_event.GetEventRecorder().SendNormalEventWithAnnotation(k8s_event.GetEventRecorder().GetObject(), annotations, k8s_event.CreateProductLogStore, "create product log success")
}

Expand Down Expand Up @@ -335,12 +333,10 @@ func (o *operationWrapper) makesureLogstoreExist(config *AliyunLogConfigSpec) er
}
annotations := GetAnnotationByObject(config, project, logstore, "", config.LogtailConfig.ConfigName, false)
if err != nil {
if k8s_event.GetEventRecorder() != nil {
customErr := CustomErrorFromSlsSDKError(err)
k8s_event.GetEventRecorder().SendErrorEventWithAnnotation(k8s_event.GetEventRecorder().GetObject(), GetAnnotationByError(annotations, customErr), k8s_event.CreateLogstore, "", fmt.Sprintf("create logstore failed, error: %s", err.Error()))
}
customErr := CustomErrorFromSlsSDKError(err)
k8s_event.GetEventRecorder().SendErrorEventWithAnnotation(k8s_event.GetEventRecorder().GetObject(), GetAnnotationByError(annotations, customErr), k8s_event.CreateLogstore, "", fmt.Sprintf("create logstore failed, error: %s", err.Error()))
return err
} else if k8s_event.GetEventRecorder() != nil {
} else {

Check failure on line 339 in helper/envconfig/aliyunlog_operation_wrapper.go

View workflow job for this annotation

GitHub Actions / CI (1.19, ubuntu)

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
k8s_event.GetEventRecorder().SendNormalEventWithAnnotation(k8s_event.GetEventRecorder().GetObject(), annotations, k8s_event.CreateLogstore, "create logstore success")
}

Expand Down

0 comments on commit 098424a

Please sign in to comment.