(filePath string)
| 301 | } |
| 302 | |
| 303 | func GetFileMD5(filePath string) (string, error) { |
| 304 | file, err := os.Open(filePath) |
| 305 | if err != nil { |
| 306 | return "", err |
| 307 | } |
| 308 | defer file.Close() |
| 309 | hash := md5.New() |
| 310 | |
| 311 | if _, err = io.Copy(hash, file); err != nil { |
| 312 | return "", err |
| 313 | } |
| 314 | return hex.EncodeToString(hash.Sum(nil)), nil |
| 315 | } |