fix: verify
This commit is contained in:
		
							parent
							
								
									63c8b418ec
								
							
						
					
					
						commit
						36b75ad578
					
				|  | @ -37,7 +37,7 @@ func checkFileChecksum(rootDir, fileName, expectedChecksum string) (bool, string | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if actualChecksum == expectedChecksum { | 	if actualChecksum == expectedChecksum { | ||||||
| 		return true, fmt.Sprintf("Checksum for %s passed!", filePath) | 		return true, ""//fmt.Sprintf("Checksum for %s passed!", filePath)
 | ||||||
| 	} else { | 	} else { | ||||||
| 		return false, fmt.Sprintf("Checksum for %s failed. Expected %s, but got %s. Please revert the changes!", filePath, expectedChecksum, actualChecksum) | 		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
 | 	// Check if the number of files matches the number of checksums
 | ||||||
| 	if len(fileNames) == 0 { | 	if len(fileNames) == 0 { | ||||||
| 		return fmt.Errorf("No checksum happened") | 		return nil//fmt.Errorf("No checksum happened")
 | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if len(fileNames) != len(checkSums) { | 	if len(fileNames) != len(checkSums) { | ||||||
|  | @ -70,15 +70,17 @@ func VerifyFiles(rootDir string,checkFileNameList string, checkFileSumList strin | ||||||
| 	for i, fileName := range fileNames { | 	for i, fileName := range fileNames { | ||||||
| 		expectedChecksum := strings.TrimSpace(checkSums[i]) | 		expectedChecksum := strings.TrimSpace(checkSums[i]) | ||||||
| 		passed, message := checkFileChecksum(rootDir, fileName, expectedChecksum) | 		passed, message := checkFileChecksum(rootDir, fileName, expectedChecksum) | ||||||
| 		return fmt.Errorf(message) | 		if message != "" { | ||||||
|  | 			return fmt.Errorf(message) | ||||||
|  | 		} | ||||||
| 		if !passed { | 		if !passed { | ||||||
| 			allPassed = false | 			allPassed = false | ||||||
| 			errorMessages = append(errorMessages, message) | 			errorMessages = append(errorMessages, message) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 	fmt.Printf("test") | ||||||
| 	if allPassed { | 	if allPassed { | ||||||
| 		return fmt.Errorf("Congratulations! All checksums passed!") | 		return nil//fmt.Errorf("Congratulations! All checksums passed!")
 | ||||||
| 	} else { | 	} else { | ||||||
| 		return fmt.Errorf("Some checksums failed. Please review the errors below:") | 		return fmt.Errorf("Some checksums failed. Please review the errors below:") | ||||||
| 		for _, msg := range errorMessages { | 		for _, msg := range errorMessages { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Hydraallen
						Hydraallen