(path string)
| 101 | } |
| 102 | |
| 103 | func get2md5(path string) (string, error) { |
| 104 | f, err := os.Open(path) |
| 105 | if err != nil { |
| 106 | return "", err |
| 107 | } |
| 108 | |
| 109 | defer f.Close() |
| 110 | |
| 111 | hash := md5.New() |
| 112 | if _, err := io.Copy(hash, f); err != nil { |
| 113 | return "", err |
| 114 | } |
| 115 | |
| 116 | // get the 16 bytes hash |
| 117 | bytes := hash.Sum(nil)[:16] |
| 118 | |
| 119 | return hex.EncodeToString(bytes), nil |
| 120 | } |
| 121 | |
| 122 | func cmpFileChecksum(t *testing.T, wantPath, gotPath string) { |
| 123 | t.Helper() |