From 36b75ad578f019a840c40cbbb4ef2338044dac2e Mon Sep 17 00:00:00 2001 From: Hydraallen Date: Mon, 26 Aug 2024 19:43:24 +0800 Subject: [PATCH] fix: verify --- pkg/healthcheck/verify.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/healthcheck/verify.go b/pkg/healthcheck/verify.go index ac9dbe6..3ca75d9 100644 --- a/pkg/healthcheck/verify.go +++ b/pkg/healthcheck/verify.go @@ -37,7 +37,7 @@ func checkFileChecksum(rootDir, fileName, expectedChecksum string) (bool, string } if actualChecksum == expectedChecksum { - return true, fmt.Sprintf("Checksum for %s passed!", filePath) + return true, ""//fmt.Sprintf("Checksum for %s passed!", filePath) } else { return false, fmt.Sprintf("Checksum for %s failed. Expected %s, but got %s. Please revert the changes!", filePath, expectedChecksum, actualChecksum) } @@ -55,7 +55,7 @@ func VerifyFiles(rootDir string,checkFileNameList string, checkFileSumList strin // Check if the number of files matches the number of checksums if len(fileNames) == 0 { - return fmt.Errorf("No checksum happened") + return nil//fmt.Errorf("No checksum happened") } if len(fileNames) != len(checkSums) { @@ -70,15 +70,17 @@ func VerifyFiles(rootDir string,checkFileNameList string, checkFileSumList strin for i, fileName := range fileNames { expectedChecksum := strings.TrimSpace(checkSums[i]) passed, message := checkFileChecksum(rootDir, fileName, expectedChecksum) - return fmt.Errorf(message) + if message != "" { + return fmt.Errorf(message) + } if !passed { allPassed = false errorMessages = append(errorMessages, message) } } - + fmt.Printf("test") if allPassed { - return fmt.Errorf("Congratulations! All checksums passed!") + return nil//fmt.Errorf("Congratulations! All checksums passed!") } else { return fmt.Errorf("Some checksums failed. Please review the errors below:") for _, msg := range errorMessages {