-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clean): log removed/untagged images (#1466)
- Loading branch information
Showing
5 changed files
with
143 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package util | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"math/rand" | ||
) | ||
|
||
// GenerateRandomSHA256 generates a random 64 character SHA 256 hash string | ||
func GenerateRandomSHA256() string { | ||
return GenerateRandomPrefixedSHA256()[7:] | ||
} | ||
|
||
// GenerateRandomPrefixedSHA256 generates a random 64 character SHA 256 hash string, prefixed with `sha256:` | ||
func GenerateRandomPrefixedSHA256() string { | ||
hash := make([]byte, 32) | ||
_, _ = rand.Read(hash) | ||
sb := bytes.NewBufferString("sha256:") | ||
sb.Grow(64) | ||
for _, h := range hash { | ||
_, _ = fmt.Fprintf(sb, "%02x", h) | ||
} | ||
return sb.String() | ||
} |
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