package version import ( "fmt" "regexp" ) var BranchPath = "/var/lib/os-branch" // Parse extracts version from LABEL="rootfs-XXXX" func Parse(label string) (string, error) { re := regexp.MustCompile(`LABEL="rootfs-([0-9]+)"`) m := re.FindStringSubmatch(label) if len(m) < 2 { return "", fmt.Errorf("version not found in: %s", label) } return m[1], nil }