Description
go tool dist list
, with or without the -json
flag, is very useful to list all supported ports. It was proposed and done in #12270.
However, there's no way to query the Go tool which of those combinations are first class ports. The current list is:
linux/amd64
linux/386
linux/arm
linux/arm64
darwin/amd64
windows/amd64
windows/386
Why do I want this list? These ports have binary releases available on golang.org, they are better tested and supported, and they are overall much more common platforms to run Go on. For example, if I'm publishing prebuilt releases for a Go program of mine, I probably want to use Go's list of first-class ports as a starting point, and only add extras if I know about a specific group of users of the prorgram.
Copy-pasting the list from the Wiki is an OK immediate workaround, but it can quickly get out of date. For example, 1.15 adds linux/arm64
to the list, so having copied the list just a few months ago would already be out of date today. The list on the wiki also reflects master; if I look at it now, I might get the impression that linux/arm64
was a first class port at the time that Go 1.14 came out, but that's not the case. go1.14 tool dist list -json
would be able to tell me that decisively.
The command already has a -json
flag to produce a JSON list, so it should be easy to add another field. For example:
$ go tool dist list -json
[
{
"GOOS": "aix",
"GOARCH": "ppc64",
"CgoSupported": true,
"FirstClass": false
},
[...]