From edaf08361fadfee205ace4a6c9ca326dcffa633e Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 28 Apr 2025 12:09:28 +0800 Subject: [PATCH] refactor: clean code --- internal/workflow/node-processor/apply_node.go | 8 ++++---- internal/workflow/node-processor/deploy_node.go | 8 ++++---- internal/workflow/node-processor/upload_node.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/workflow/node-processor/apply_node.go b/internal/workflow/node-processor/apply_node.go index 265437ea..97b7575d 100644 --- a/internal/workflow/node-processor/apply_node.go +++ b/internal/workflow/node-processor/apply_node.go @@ -41,11 +41,11 @@ func (n *applyNode) Process(ctx context.Context) error { } // 检测是否可以跳过本次执行 - if skippable, skipReason := n.checkCanSkip(ctx, lastOutput); skippable { - n.logger.Info(fmt.Sprintf("skip this application, because %s", skipReason)) + if skippable, reason := n.checkCanSkip(ctx, lastOutput); skippable { + n.logger.Info(fmt.Sprintf("skip this application, because %s", reason)) return nil - } else if skipReason != "" { - n.logger.Info(fmt.Sprintf("re-apply, because %s", skipReason)) + } else if reason != "" { + n.logger.Info(fmt.Sprintf("re-apply, because %s", reason)) } // 初始化申请器 diff --git a/internal/workflow/node-processor/deploy_node.go b/internal/workflow/node-processor/deploy_node.go index 01d899a4..d60a5a7a 100644 --- a/internal/workflow/node-processor/deploy_node.go +++ b/internal/workflow/node-processor/deploy_node.go @@ -54,11 +54,11 @@ func (n *deployNode) Process(ctx context.Context) error { // 检测是否可以跳过本次执行 if lastOutput != nil && certificate.CreatedAt.Before(lastOutput.UpdatedAt) { - if skippable, skipReason := n.checkCanSkip(ctx, lastOutput); skippable { - n.logger.Info(fmt.Sprintf("skip this deployment, because %s", skipReason)) + if skippable, reason := n.checkCanSkip(ctx, lastOutput); skippable { + n.logger.Info(fmt.Sprintf("skip this deployment, because %s", reason)) return nil - } else if skipReason != "" { - n.logger.Info(fmt.Sprintf("re-deploy, because %s", skipReason)) + } else if reason != "" { + n.logger.Info(fmt.Sprintf("re-deploy, because %s", reason)) } } diff --git a/internal/workflow/node-processor/upload_node.go b/internal/workflow/node-processor/upload_node.go index 891f2978..2da19eed 100644 --- a/internal/workflow/node-processor/upload_node.go +++ b/internal/workflow/node-processor/upload_node.go @@ -39,11 +39,11 @@ func (n *uploadNode) Process(ctx context.Context) error { } // 检测是否可以跳过本次执行 - if skippable, skipReason := n.checkCanSkip(ctx, lastOutput); skippable { - n.logger.Info(fmt.Sprintf("skip this upload, because %s", skipReason)) + if skippable, reason := n.checkCanSkip(ctx, lastOutput); skippable { + n.logger.Info(fmt.Sprintf("skip this upload, because %s", reason)) return nil - } else if skipReason != "" { - n.logger.Info(fmt.Sprintf("re-upload, because %s", skipReason)) + } else if reason != "" { + n.logger.Info(fmt.Sprintf("re-upload, because %s", reason)) } // 生成证书实体