use regexp.MustCompile

Co-Authored-By: David Genest <david.genest@gmail.com>
This commit is contained in:
Benoit Gagnon 2019-10-24 10:47:35 -04:00 committed by GitHub
parent a44fae09a0
commit f09b41c7da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,7 +178,7 @@ func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (st
// If the ref resolution failed and "version" looks like a SHA1, assume it is one // If the ref resolution failed and "version" looks like a SHA1, assume it is one
// and proceed. // and proceed.
commitShaPattern, _ := regexp.Compile("^([0-9a-f]{40})$") commitShaPattern := regexp.MustCompile("^([0-9a-f]{40})$")
if commitSha == "" && commitShaPattern.MatchString(version) { if commitSha == "" && commitShaPattern.MatchString(version) {
commitSha = version commitSha = version
} }