Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 3ab186d

Browse files
test: add tests for go output
Signed-off-by: James Elliott <[email protected]>
1 parent 522aa6b commit 3ab186d

File tree

5 files changed

+919
-128
lines changed

5 files changed

+919
-128
lines changed

const.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
goosWindows = "windows"
3535
goosLinux = "linux"
3636
goosDarwin = "darwin"
37+
goosIOS = "ios"
3738
goosFreeBSD = "freebsd"
3839
goosNetBSD = "netbsd"
3940
goosOpenBSD = "openbsd"
@@ -45,23 +46,24 @@ const (
4546
goosJavaScript = "js"
4647
goosAIX = "aix"
4748
goosIllumos = "illumos"
49+
goosWASIP1 = "wasip1"
4850
)
4951

5052
// Go Architecture values for GOARCH.
5153
const (
52-
goarch386 = "386"
53-
goarchAMD64 = "amd64"
54-
goarchAMD64P32 = "amd64p32"
55-
goarchARM = "arm"
56-
goarchARM64 = "arm64"
57-
gooarchMIPS = "mips"
58-
gooarchMIPSLE = "mipsle"
59-
goarchMIPS64 = "mips64"
60-
goarchMIPS64LE = "mips64le"
61-
goarchS390X = "s390x"
62-
gooarchPowerPC64 = "ppc64"
63-
gooarchPowerPC64LE = "ppc64le"
64-
gooarchRISCV64 = "riscv64"
65-
gooarchLoong64 = "loong64"
66-
gooarchWebAssembly = "wasm"
54+
goarch386 = "386"
55+
goarchAMD64 = "amd64"
56+
goarchAMD64P32 = "amd64p32"
57+
goarchARM = "arm"
58+
goarchARM64 = "arm64"
59+
goarchMIPS = "mips"
60+
goarchMIPSLE = "mipsle"
61+
goarchMIPS64 = "mips64"
62+
goarchMIPS64LE = "mips64le"
63+
goarchS390X = "s390x"
64+
goarchPowerPC64 = "ppc64"
65+
goarchPowerPC64LE = "ppc64le"
66+
goarchRISCV64 = "riscv64"
67+
goarchLoong64 = "loong64"
68+
goarchWebAssembly = "wasm"
6769
)

constraints.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func init() {
5757
platforms []Platform
5858
}{
5959
{"<= 1.0", Platforms_1_0},
60-
{">= 1.1, < 1.3", Platforms_1_1},
60+
{">= 1.1, < 1.2", Platforms_1_1},
61+
{">= 1.2, < 1.3", Platforms_1_2},
6162
{">= 1.3, < 1.4", Platforms_1_3},
6263
{">= 1.4, < 1.5", Platforms_1_4},
6364
{">= 1.5, < 1.6", Platforms_1_5},

platform.go

Lines changed: 185 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func addDrop(base []Platform, add []Platform, drop []Platform) []Platform {
4545
if found == len(newPlatforms)-1 {
4646
newPlatforms = newPlatforms[:found]
4747
} else if found == 0 {
48-
newPlatforms = newPlatforms[found:]
48+
newPlatforms = newPlatforms[found+1:]
4949
} else {
5050
newPlatforms = append(newPlatforms[:found], newPlatforms[found+1:]...)
5151
}
@@ -68,121 +68,194 @@ var (
6868
{goosWindows, goarchAMD64, true},
6969
}
7070

71-
Platforms_1_1 = addDrop(Platforms_1_0, []Platform{
72-
{goosFreeBSD, goarchARM, true},
73-
{goosNetBSD, goarch386, true},
74-
{goosNetBSD, goarchAMD64, true},
75-
{goosNetBSD, goarchARM, true},
76-
{goosPlan9, goarch386, false},
77-
}, nil)
78-
79-
Platforms_1_3 = addDrop(Platforms_1_1, []Platform{
80-
{goosDragonfly, goarch386, false},
81-
{goosDragonfly, goarchAMD64, false},
82-
{goosNACL, goarchAMD64, false},
83-
{goosNACL, goarchAMD64P32, false},
84-
{goosNACL, goarchARM, false},
85-
{goosSolaris, goarchAMD64, false},
86-
}, nil)
87-
88-
Platforms_1_4 = addDrop(Platforms_1_3, []Platform{
89-
{goosAndroid, goarchARM, false},
90-
{goosPlan9, goarchAMD64, false},
91-
}, nil)
92-
93-
Platforms_1_5 = addDrop(Platforms_1_4, []Platform{
94-
{goosDarwin, goarchARM, false},
95-
{goosDarwin, goarchARM64, false},
96-
{goosLinux, goarchARM64, false},
97-
{goosLinux, gooarchPowerPC64, false},
98-
{goosLinux, gooarchPowerPC64LE, false},
99-
}, nil)
100-
101-
Platforms_1_6 = addDrop(Platforms_1_5, []Platform{
102-
{goosAndroid, goarch386, false},
103-
{goosAndroid, goarchAMD64, false},
104-
{goosLinux, goarchMIPS64, false},
105-
{goosLinux, goarchMIPS64LE, false},
106-
{goosNACL, goarch386, false},
107-
{goosOpenBSD, goarchARM, true},
108-
}, nil)
109-
110-
Platforms_1_7 = addDrop(Platforms_1_5, []Platform{
111-
// While not fully supported s390x is generally useful
112-
{goosLinux, goarchS390X, true},
113-
{goosPlan9, goarchARM, false},
114-
// Add the 1.6 Platforms, but reflect full support for mips64 and mips64le
115-
{goosAndroid, goarch386, false},
116-
{goosAndroid, goarchAMD64, false},
117-
{goosLinux, goarchMIPS64, true},
118-
{goosLinux, goarchMIPS64LE, true},
119-
{goosNACL, goarch386, false},
120-
{goosOpenBSD, goarchARM, true},
121-
}, nil)
122-
123-
Platforms_1_8 = addDrop(Platforms_1_7, []Platform{
124-
{goosLinux, gooarchMIPS, true},
125-
{goosLinux, gooarchMIPSLE, true},
126-
}, nil)
71+
Platforms_1_1 = addDrop(Platforms_1_0,
72+
[]Platform{
73+
{goosFreeBSD, goarchARM, true},
74+
{goosNetBSD, goarch386, true},
75+
{goosNetBSD, goarchAMD64, true},
76+
{goosNetBSD, goarchARM, true},
77+
{goosPlan9, goarch386, false},
78+
},
79+
nil,
80+
)
81+
82+
// no new platforms in 1.2
83+
Platforms_1_2 = Platforms_1_1
84+
85+
Platforms_1_3 = addDrop(Platforms_1_2,
86+
[]Platform{
87+
{goosDragonfly, goarch386, false},
88+
{goosDragonfly, goarchAMD64, false},
89+
{goosNACL, goarchAMD64, false},
90+
{goosNACL, goarchAMD64P32, false},
91+
{goosNACL, goarchARM, false},
92+
{goosSolaris, goarchAMD64, false},
93+
},
94+
nil,
95+
)
96+
97+
Platforms_1_4 = addDrop(Platforms_1_3,
98+
[]Platform{
99+
{goosAndroid, goarchARM, false},
100+
{goosPlan9, goarchAMD64, false},
101+
},
102+
nil,
103+
)
104+
105+
Platforms_1_5 = addDrop(Platforms_1_4,
106+
[]Platform{
107+
{goosDarwin, goarchARM, false},
108+
{goosDarwin, goarchARM64, false},
109+
{goosLinux, goarchARM64, false},
110+
{goosLinux, goarchPowerPC64, false},
111+
{goosLinux, goarchPowerPC64LE, false},
112+
},
113+
nil,
114+
)
115+
116+
Platforms_1_6 = addDrop(Platforms_1_5,
117+
[]Platform{
118+
{goosAndroid, goarch386, false},
119+
{goosAndroid, goarchAMD64, false},
120+
{goosLinux, goarchMIPS64, false},
121+
{goosLinux, goarchMIPS64LE, false},
122+
{goosNACL, goarch386, false},
123+
{goosOpenBSD, goarchARM, true},
124+
},
125+
nil,
126+
)
127+
128+
Platforms_1_7 = addDrop(Platforms_1_5,
129+
[]Platform{
130+
// Add the 1.6 Platforms, but reflect full support for mips64 and mips64le
131+
{goosAndroid, goarch386, false},
132+
{goosAndroid, goarchAMD64, false},
133+
{goosLinux, goarchMIPS64, true},
134+
{goosLinux, goarchMIPS64LE, true},
135+
{goosNACL, goarch386, false},
136+
{goosOpenBSD, goarchARM, true},
137+
138+
{goosAndroid, goarchARM64, false},
139+
{goosLinux, goarchS390X, true},
140+
{goosPlan9, goarchARM, false},
141+
},
142+
[]Platform{
143+
{goosNACL, goarchAMD64, false},
144+
{goosDragonfly, goarch386, false},
145+
},
146+
)
147+
148+
Platforms_1_8 = addDrop(Platforms_1_7,
149+
[]Platform{
150+
{goosLinux, goarchMIPS, true},
151+
{goosLinux, goarchMIPSLE, true},
152+
},
153+
nil,
154+
)
127155

128156
// no new platforms in 1.9
129157
Platforms_1_9 = Platforms_1_8
130158

131-
// unannounced, but dropped support for android/amd64
132-
Platforms_1_10 = addDrop(Platforms_1_9, nil, []Platform{{goosAndroid, goarchAMD64, false}})
133-
134-
Platforms_1_11 = addDrop(Platforms_1_10, []Platform{
135-
{goosJavaScript, gooarchWebAssembly, true},
136-
}, nil)
137-
138-
Platforms_1_12 = addDrop(Platforms_1_11, []Platform{
139-
{goosAIX, gooarchPowerPC64, false},
140-
{goosWindows, goarchARM, true},
141-
}, nil)
142-
143-
Platforms_1_13 = addDrop(Platforms_1_12, []Platform{
144-
{goosIllumos, goarchAMD64, false},
145-
{goosNetBSD, goarchARM64, true},
146-
{goosOpenBSD, goarchARM64, true},
147-
}, nil)
148-
149-
Platforms_1_14 = addDrop(Platforms_1_13, []Platform{
150-
{goosFreeBSD, goarchARM64, true},
151-
{goosLinux, gooarchRISCV64, true},
152-
}, []Platform{
153-
// drop nacl
154-
{goosNACL, goarch386, false},
155-
{goosNACL, goarchAMD64, false},
156-
{goosNACL, goarchARM, false},
157-
})
158-
159-
Platforms_1_15 = addDrop(Platforms_1_14, []Platform{
160-
{goosAndroid, goarchARM64, false},
161-
}, []Platform{
162-
// drop i386 macos
163-
{goosDarwin, goarch386, false},
164-
})
165-
166-
Platforms_1_16 = addDrop(Platforms_1_15, []Platform{
167-
{goosAndroid, goarchAMD64, false},
168-
{goosDarwin, goarchARM64, true},
169-
{goosOpenBSD, goarchMIPS64, false},
170-
}, nil)
171-
172-
Platforms_1_17 = addDrop(Platforms_1_16, []Platform{
173-
{goosWindows, goarchARM64, true},
174-
}, nil)
175-
176-
// no new platforms in 1.18
177-
Platforms_1_18 = Platforms_1_17
178-
179-
Platforms_1_19 = addDrop(Platforms_1_18, []Platform{
180-
{goosLinux, gooarchLoong64, true},
181-
}, nil)
182-
183-
Platforms_1_20 = Platforms_1_19
184-
185-
PlatformsLatest = Platforms_1_20
159+
// no new platforms in 1.10
160+
Platforms_1_10 = Platforms_1_9
161+
162+
Platforms_1_11 = addDrop(Platforms_1_10,
163+
[]Platform{
164+
{goosJavaScript, goarchWebAssembly, true},
165+
{goosLinux, goarchRISCV64, false},
166+
},
167+
nil,
168+
)
169+
170+
Platforms_1_12 = addDrop(Platforms_1_11,
171+
[]Platform{
172+
{goosAIX, goarchPowerPC64, false},
173+
{goosWindows, goarchARM, true},
174+
},
175+
[]Platform{
176+
{goosLinux, goarchRISCV64, false},
177+
},
178+
)
179+
180+
Platforms_1_13 = addDrop(Platforms_1_12,
181+
[]Platform{
182+
{goosIllumos, goarchAMD64, false},
183+
{goosNetBSD, goarchARM64, true},
184+
{goosOpenBSD, goarchARM64, true},
185+
},
186+
nil,
187+
)
188+
189+
Platforms_1_14 = addDrop(Platforms_1_13,
190+
[]Platform{
191+
{goosFreeBSD, goarchARM64, true},
192+
{goosLinux, goarchRISCV64, true},
193+
},
194+
[]Platform{
195+
// drop nacl
196+
{goosNACL, goarch386, false},
197+
{goosNACL, goarchARM, false},
198+
{goosNACL, goarchAMD64P32, false},
199+
},
200+
)
201+
202+
Platforms_1_15 = addDrop(Platforms_1_14,
203+
nil,
204+
[]Platform{
205+
{goosDarwin, goarch386, false},
206+
{goosDarwin, goarchARM, false},
207+
},
208+
)
209+
210+
Platforms_1_16 = addDrop(Platforms_1_15,
211+
[]Platform{
212+
{goosAndroid, goarchAMD64, false},
213+
{goosDarwin, goarchARM64, true},
214+
{goosIOS, goarchARM64, false},
215+
{goosIOS, goarchAMD64, false},
216+
{goosOpenBSD, goarchMIPS64, false},
217+
},
218+
nil,
219+
)
220+
221+
Platforms_1_17 = addDrop(Platforms_1_16,
222+
[]Platform{
223+
{goosWindows, goarchARM64, true},
224+
},
225+
nil,
226+
)
227+
228+
Platforms_1_18 = addDrop(Platforms_1_17,
229+
[]Platform{
230+
{goosIllumos, goarchAMD64, false},
231+
},
232+
nil,
233+
)
234+
235+
Platforms_1_19 = addDrop(Platforms_1_18,
236+
[]Platform{
237+
{goosLinux, goarchLoong64, true},
238+
},
239+
nil,
240+
)
241+
242+
Platforms_1_20 = addDrop(Platforms_1_19,
243+
[]Platform{
244+
{goosFreeBSD, goarchRISCV64, false},
245+
},
246+
nil,
247+
)
248+
249+
Platforms_1_21 = addDrop(Platforms_1_20,
250+
[]Platform{
251+
{goosWASIP1, goarchWebAssembly, false},
252+
},
253+
[]Platform{
254+
{goosOpenBSD, goarchMIPS64, false},
255+
},
256+
)
257+
258+
PlatformsLatest = Platforms_1_21
186259
)
187260

188261
// SupportedPlatforms returns the full list of supported platforms for

0 commit comments

Comments
 (0)