X Tutup
Skip to content

Commit 5fa5f15

Browse files
committed
Add amd64->386 fallback
Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
1 parent 6bf5650 commit 5fa5f15

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

platforms/compare.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ func platformVector(platform specs.Platform) []specs.Platform {
3737
vector := []specs.Platform{platform}
3838

3939
switch platform.Architecture {
40+
case "amd64":
41+
vector = append(vector, specs.Platform{
42+
Architecture: "386",
43+
OS: platform.OS,
44+
OSVersion: platform.OSVersion,
45+
OSFeatures: platform.OSFeatures,
46+
Variant: platform.Variant,
47+
})
4048
case "arm":
4149
if armVersion, err := strconv.Atoi(strings.TrimPrefix(platform.Variant, "v")); err == nil && armVersion > 5 {
4250
for armVersion--; armVersion >= 5; armVersion-- {
@@ -60,6 +68,7 @@ func platformVector(platform specs.Platform) []specs.Platform {
6068
// For arm/v8, will also match arm/v7, arm/v6 and arm/v5
6169
// For arm/v7, will also match arm/v6 and arm/v5
6270
// For arm/v6, will also match arm/v5
71+
// For amd64, will also match 386
6372
func Only(platform specs.Platform) MatchComparer {
6473
return Ordered(platformVector(Normalize(platform))...)
6574
}

platforms/compare_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ func TestOnly(t *testing.T) {
3030
matches: map[bool][]string{
3131
true: {
3232
"linux/amd64",
33+
"linux/386",
3334
},
3435
false: {
35-
"linux/386",
3636
"linux/arm/v7",
3737
"linux/arm64",
3838
"windows/amd64",

0 commit comments

Comments
 (0)
X Tutup