-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6353 from jhawk28/pull-improvements
Improve pull for transit/bootstrap
- Loading branch information
Showing
5 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package utils | ||
|
||
// The google storage API only provides md5 and crc32 hence overriding the linter flag for md5 | ||
// #nosec | ||
import ( | ||
"crypto/md5" | ||
"io" | ||
"os" | ||
) | ||
|
||
func CalcMd5(outpath string) []byte { | ||
f, err := os.Open(outpath) | ||
if err != nil { | ||
return nil | ||
} | ||
defer f.Close() | ||
|
||
// #nosec | ||
h := md5.New() | ||
if _, err := io.Copy(h, f); err != nil { | ||
return nil | ||
} | ||
|
||
return h.Sum(nil) | ||
} |