Move packages to root folder
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 33s

Signed-off-by: Jan Tytgat <jan.tytgat@corelayer.eu>
This commit is contained in:
Jan Tytgat
2025-04-22 13:47:12 +02:00
parent 26059ea3e9
commit 4fab7c8554
17 changed files with 8 additions and 6 deletions

23
semver/metadata.go Normal file
View File

@ -0,0 +1,23 @@
package semver
import (
"fmt"
"regexp"
)
const (
validMetadata = `^(?P<commit>[0-9a-zA-Z]{8}).(?P<date>[0-9]{8})$`
)
var regexMetadata = regexp.MustCompile(validMetadata)
type Metadata string
func SplitMetadata(m Metadata) (string, string, error) {
if !regexMetadata.MatchString(string(m)) {
return "", "", fmt.Errorf("invalid metadata: %s", m)
}
match := regexMetadata.FindStringSubmatch(string(m))
return match[1], match[2], nil
}