#!/bin/bash source out1.sh source out2.sh ### # This list is based on: # https://github.com/golang/go/blob/master/src/go/build/syslist.go gooses=( aix android darwin dragonfly freebsd hurd illumos ios js \ linux nacl netbsd openbsd plan9 solaris windows zos ) gooses=($(printf -- '%s\n' "${gooses[@]}" | sort)) # This list is based on: # https://github.com/golang/go/blob/master/src/go/build/syslist.go goarches=( 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le \ loong64 mips mipsle mips64 mips64le mips64p32 mips64p32le \ ppc riscv riscv64 s390 s390x sparc sparc64 wasm ) goarches=($(printf -- '%s\n' "${goarches[@]}" | sort)) # This list is based on my knowledge, the result of 4-make2.sh, and the link below: # https://golang.org/doc/install/source goarches_32=( 386 amd64p32 arm armbe mips mipsle \ mips64p32 mips64p32le ppc riscv s390 sparc ) goarches_32=($(printf -- '%s\n' "${goarches_32[@]}" | sort)) # This list is based on my knowledge, the result of 4-make2.sh, and the link below: # https://golang.org/doc/install/source goarches_64=( amd64 arm64 arm64be ppc64 ppc64le loong64 \ mips64 mips64le riscv64 s390x sparc64 wasm ) goarches_64=($(printf -- '%s\n' "${goarches_64[@]}" | sort)) ### ############################# # Functions for Computation # ############################# # Usage: # is_in_array $target ${array[@]} is_in_array() { target="$1" shift array=("$@") for item in "${array[@]}" do if [ "$item" = "$target" ] then return 0 fi done return 1 } # Usage: # cmp_arrays $len_base_array ${base_array[@]} ${filtered_array[@]} cmp_arrays() { len_base_array=$1 shift base_array=() for ((i=0; i NOTE\n' printf -- '>\n' printf -- '> "Out of the box" means the GOOS is supported out of the box, i.e. the stocked `go` command can build the source code without the help of a C compiler, etc.\n' printf -- '\n' printf -- '> NOTE\n' printf -- '>\n' printf -- '> The full list is based on https://github.com/golang/go/blob/master/src/go/build/syslist.go. The "out of the box" information is based on the result of [2-make1.sh](#file-2-make1-sh) below.\n' printf -- '\n' ### printf -- '## GOARCH Values\n' printf -- '\n' print_goarches_table printf -- 'All GOARCH values:\n' print_list "${goarches[@]}" printf -- 'All 32-bit GOARCH values:\n' print_list "${goarches_32[@]}" printf -- 'All 64-bit GOARCH values:\n' print_list "${goarches_64[@]}" printf -- '"Out of the box" GOARCH values:\n' print_list "${ootb_goarches[@]}" printf -- '"Out of the box" 32-bit GOARCH values:\n' print_list "${ootb_goarches_32[@]}" printf -- '"Out of the box" 64-bit GOARCH values:\n' print_list "${ootb_goarches_64[@]}" printf -- '> NOTE\n' printf -- '>\n' printf -- '> "Out of the box" means the GOARCH is supported out of the box, i.e. the stocked `go` command can build the source code without the help of a C compiler, etc.\n' printf -- '\n' printf -- '> NOTE\n' printf -- '>\n' printf -- '> The full list is based on https://github.com/golang/go/blob/master/src/go/build/syslist.go. The "out of the box" information is based on the result of [2-make1.sh](#file-2-make1-sh) below. The "32-bit/64-bit" information is based on the result of [4-make2.sh](#file-4-make2-sh) below and https://golang.org/doc/install/source.\n' printf -- '\n' ### printf -- '## Platform Values\n' printf -- '\n' print_platforms_table printf -- 'All Platform values:\n' print_list "${platforms[@]}" printf -- 'All 32-bit Platform values:\n' print_list "${platforms_32[@]}" printf -- 'All 64-bit Platform values:\n' print_list "${platforms_64[@]}" printf -- '"Out of the box" Platform values:\n' print_list "${ootb_platforms[@]}" printf -- '"Out of the box" 32-bit Platform values:\n' print_list "${ootb_platforms_32[@]}" printf -- '"Out of the box" 64-bit Platform values:\n' print_list "${ootb_platforms_64[@]}" printf -- '> NOTE\n' printf -- '>\n' printf -- '> "Out of the box" means the platform is supported out of the box, i.e. the stocked `go` command can build the source code without the help of a C compiler, etc.\n' printf -- '\n' printf -- '> NOTE\n' printf -- '>\n' printf -- '> The full list is based on the result of the command `go tool dist list`. The "out of the box" information is based on the result of [2-make1.sh](#file-2-make1-sh) below. The "32-bit/64-bit" information is based on the result of [4-make2.sh](#file-4-make2-sh) below and https://golang.org/doc/install/source.\n' printf -- '\n' ### printf -- '## Support Grid 1\n' printf -- '\n' print_support_grid_1 printf -- '## Support Grid 2\n' printf -- '\n' print_support_grid_2 printf -- '✅: Supported (out of the box)\n' printf -- '\n' printf -- '☑️: Supported (with the help of a C compiler, etc.)\n' printf -- '\n' printf -- '(blank): Unsupported\n' printf -- '\n' printf -- '> NOTE\n' printf -- '>\n' printf -- '> The `nacl` GOOS was dropped since `go version 1.14`\n' printf -- '>\n' printf -- '> The `amd64p32` GOARCH, which is related to the `nacl` GOOS, was also dropped since `go version 1.14` (I believe that `mips64p32` and `mips64p32le` are also related, but I could not find any reference)\n' printf -- '>\n' printf -- '> Reference: https://golang.org/doc/go1.14#nacl\n' printf -- '\n' printf -- '> NOTE\n' printf -- '>\n' printf -- '> The `darwin/386` port was dropped since `go version 1.15`\n' printf -- '>\n' printf -- '> Reference: https://golang.org/doc/go1.15#darwin\n' printf -- '\n' printf -- '> NOTE\n' printf -- '>\n' printf -- '> On before `go version 1.16`:\n' printf -- '> - `darwin/amd64` means **macOS**\n' printf -- '> - `darwin/arm64` means **iOS**\n' printf -- '>\n' printf -- '> With the introduction of Apple Silicon (a.k.a. the M1 chip), on `go version 1.16` or later:\n' printf -- '> - `darwin/amd64` means **macOS** with Intel CPU\n' printf -- '> - `darwin/arm64` updates to mean **macOS** with Apple Silicon CPU\n' printf -- '> - `ios/amd64` is the new port for **iOS Simulator** on macOS with Intel CPU\n' printf -- '> - `ios/arm64` is the new port for **iOS**\n' printf -- '>\n' printf -- '> Reference: https://golang.org/doc/go1.16#darwin\n'