Fix index generation parallelly failure (#25235)

Fix #22109

---------

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Lunny Xiao 2023-06-15 08:14:43 +08:00 committed by GitHub
parent 5440d37c70
commit cc3910d8c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 0 deletions

View file

@ -28,6 +28,14 @@ func IsValidSHAPattern(sha string) bool {
return shaPattern.MatchString(sha)
}
type ErrInvalidSHA struct {
SHA string
}
func (err ErrInvalidSHA) Error() string {
return fmt.Sprintf("invalid sha: %s", err.SHA)
}
// MustID always creates a new SHA1 from a [20]byte array with no validation of input.
func MustID(b []byte) SHA1 {
var id SHA1