Skip to content

Commit

Permalink
Safer operation on variant string
Browse files Browse the repository at this point in the history
  • Loading branch information
harryzcy committed Jun 27, 2024
1 parent 0cdbb8b commit 394e655
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func platformVector(platform specs.Platform) []specs.Platform {
variant = "v8"
}

if armMajor, err := strconv.Atoi(strings.TrimPrefix(variant[:2], "v")); err == nil && armMajor >= 8 {
majorVariant, _, _ := strings.Cut(variant, ".") // v8.0 -> v8
if armMajor, err := strconv.Atoi(strings.TrimPrefix(majorVariant, "v")); err == nil && armMajor >= 8 {
armMinor := 0
if len(variant) == 4 {
if minor, err := strconv.Atoi(variant[3:]); err == nil && variant[2] == '.' {
Expand Down

0 comments on commit 394e655

Please sign in to comment.