-
-
Save idfumg/0cee7c17535f8038a13a156dd23fb26c to your computer and use it in GitHub Desktop.
Revisions
-
asukakenji revised this gist
Sep 15, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash # This list is based on: # https://github.com/golang/go/blob/master/src/go/build/syslist.go -
asukakenji revised this gist
Sep 15, 2021 . 6 changed files with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ All GOOS values: > NOTE > > 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. ## GOARCH Values @@ -107,7 +107,7 @@ All 64-bit GOARCH values: > NOTE > > 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. ## Platform Values @@ -195,7 +195,7 @@ All 64-bit Platform values: > NOTE > > 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. ## Support Grid 1 File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ do is_goos_ootb=0 for goarch in "${goarches[@]}" do GOOS="$goos" GOARCH="$goarch" go build -o /dev/null 1-main1.go >out.log 2>err.log if [ $? -eq 0 ] then if [ $is_goos_ootb -eq 0 ] File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ for ootb_platform in "${ootb_platforms[@]}" do ootb_goos=${ootb_platform%/*} ootb_goarch=${ootb_platform#*/} GOOS="${ootb_goos}" GOARCH="${ootb_goarch}" go build -o /dev/null 3-main2.go >/dev/null 2>&1 if [ $? -eq 0 ] then ootb_goarches_64+=(${ootb_goarch}) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,15 +22,15 @@ goarches=( ) 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 \ @@ -558,7 +558,7 @@ 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' ### @@ -592,7 +592,7 @@ 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' ### @@ -626,7 +626,7 @@ 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' ### -
asukakenji revised this gist
Sep 15, 2021 . 6 changed files with 1110 additions and 382 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,677 @@ #!/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 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 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<len_base_array; i++)) do base_array+=("$1") shift done filtered_array=("$@") len_filtered_array=${#filtered_array[@]} i=0 for item in "${base_array[@]}" do if [ $i -lt $len_filtered_array -a "$item" = "${filtered_array[i]}" ] then printf -- '1\n' ((++i)) else printf -- '0\n' fi done } # Usage: # cmp3_arrays $len_base_array ${base_array[@]} $len_filtered_array1 ${filtered_array1[@]} ${filtered_array2[@]} cmp3_arrays() { len_base_array=$1 shift base_array=() for ((i=0; i<len_base_array; i++)) do base_array+=("$1") shift done len_filtered_array1=$1 shift filtered_array1=() for ((i=0; i<len_filtered_array1; i++)) do filtered_array1+=("$1") shift done filtered_array2=("$@") len_filtered_array2=${#filtered_array2[@]} i=0 j=0 for item in "${base_array[@]}" do if [ $i -lt $len_filtered_array1 -a "$item" = "${filtered_array1[i]}" ] then if [ $j -lt $len_filtered_array2 -a "$item" = "${filtered_array2[j]}" ] then printf -- '1\n' ((++j)) else printf -- '2\n' fi ((++i)) else printf -- '0\n' fi done } # Usage: # add_prefix_to_array $prefix ${array[@]} add_prefix_to_array() { prefix="$1" shift array=("$@") for item in "${array[@]}" do printf -- '%s%s\n' "$prefix" "$item" done } # Usage: # filter_array_by_prefix $prefix ${array[@]} filter_array_by_prefix() { prefix="$1" len_prefix=${#prefix} shift array=("$@") for item in "${array[@]}" do if [ "${item:0:$len_prefix}" = "$prefix" ] then printf -- '%s\n' "$item" fi done } ### # Results platforms=() platforms_32=() platforms_64=() platforms=($(go tool dist list)) platforms=($(printf -- '%s\n' "${platforms[@]}" | sort)) for platform in "${platforms[@]}" do goarch="${platform#*/}" if is_in_array "$goarch" "${goarches_32[@]}" then platforms_32+=("$platform") else platforms_64+=("$platform") fi done ### ################################# # Functions for Printing Result # ################################# repeat() { ch="$1" n=$2 for ((i=0; i<n; i++)) do printf -- '%s' "$ch" done } left() { n=$1 printf -- ':' repeat '-' $((n-1)) } right() { n=$1 repeat '-' $((n-1)) printf -- ':' } center() { n=$1 printf -- ':' repeat '-' $((n-2)) printf -- ':' } code() { printf -- '`%s`\n' "$@" } bold() { printf -- '**%s**\n' "$@" } bold_code() { printf -- '**`%s`**\n' "$@" } ### # Usage: # print_table $col_count row_count headers... alignments... is_bools... col1... col2... ... print_table() { has_footer=$1 col_count=$2 row_count=$3 shift 3 headers=() for ((c=0; c<col_count; c++)) do headers+=("$1") shift done if [ $has_footer -ne 0 ] then footers=() for ((c=0; c<col_count; c++)) do if [ "${headers[c]}" = '' ] then footers+=('') continue fi footers+=($(bold "${headers[c]}")) done fi alignments=() for ((c=0; c<col_count; c++)) do alignments+=("$1") shift done is_bools=() for ((c=0; c<col_count; c++)) do is_bools+=($1) shift done body=("$@") lens=() for ((c=0; c<col_count; c++)) do maxlen=${#headers[c]} for ((r=0; r<row_count; r++)) do len=${#body[c*row_count+r]} if [ $len -gt $maxlen ] then maxlen=$len fi done if [ $maxlen -lt 3 ] then maxlen=3 fi lens+=($maxlen) done fmts=() for ((c=0; c<col_count; c++)) do if [ ${is_bools[c]} -eq 0 ] then fmt=$(printf -- '| %%-%ds ' ${lens[c]}) else fmt=$(printf -- '| %%s%%-%ds ' $((lens[c] - 1))) # -1 for the length of $ootb fi # Last column if [ $c -eq $((col_count - 1)) ] then fmt+='|\n' fi fmts+=("$fmt") done fmt=$(printf -- '%s' "${fmts[@]}") # Print Header _headers=() for ((c=0; c<col_count; c++)) do if [ ${is_bools[c]} -eq 0 ] then _headers+=("${headers[c]}") else _headers+=('' "${headers[c]}") fi done printf -- "$fmt" "${_headers[@]}" # Print Separator seps=() for ((c=0; c<col_count; c++)) do if [ ${is_bools[c]} -eq 0 ] then seps+=("$(${alignments[c]} ${lens[c]})") else seps+=('' "$(${alignments[c]} ${lens[c]})") fi done printf -- "$fmt" "${seps[@]}" # Print Body for ((r=0; r<row_count; r++)) do row=() for ((c=0; c<col_count; c++)) do cell="${body[c*row_count+r]}" if [ ${is_bools[c]} -eq 0 ] then row+=("$cell") else if [ $cell -eq 0 ] then row+=(' ' '') elif [ $cell -eq 1 ] then row+=('✅' '') # This counts 3 bytes in printf, so it must be handled separately elif [ $cell -eq 2 ] then row+=('☑️' '') # This counts 3 bytes in printf, so it must be handled separately else # Panic printf -- 'Unknown value of $cell: %d\n' $cell exit fi fi done printf -- "$fmt" "${row[@]}" done # Print Footer if [ $has_footer -ne 0 ] then printf -- '| %s ' "${footers[@]}" printf -- '|\n' fi printf -- '\n' } print_list() { arr=("$@") fmt='"%s"' printf -- '```text\n' for elem in "${arr[@]}" do printf -- "$fmt" "$elem" fmt=', "%s"' done printf -- '\n```\n\n' } print_gooses_table() { headers=('GOOS' 'Out of the Box') alignments=(left center) is_bools=(0 1) col1=($(code "${gooses[@]}")) col2=($(cmp_arrays ${#gooses[@]} "${gooses[@]}" "${ootb_gooses[@]}")) col_count=${#headers[@]} row_count=${#col1[@]} print_table 0 $col_count $row_count \ "${headers[@]}" "${alignments[@]}" ${is_bools[@]} \ "${col1[@]}" ${col2[@]} } print_goarches_table() { headers=('GOARCH' 'Out of the Box' '32-bit' '64-bit') alignments=(left center center center) is_bools=(0 1 1 1) col1=($(code "${goarches[@]}")) col2=($(cmp_arrays ${#goarches[@]} "${goarches[@]}" "${ootb_goarches[@]}")) col3=($(cmp_arrays ${#goarches[@]} "${goarches[@]}" "${goarches_32[@]}")) col4=($(cmp_arrays ${#goarches[@]} "${goarches[@]}" "${goarches_64[@]}")) col_count=${#headers[@]} row_count=${#col1[@]} print_table 0 $col_count $row_count \ "${headers[@]}" "${alignments[@]}" ${is_bools[@]} \ "${col1[@]}" ${col2[@]} ${col3[@]} ${col4[@]} } print_platforms_table() { headers=('Platform' 'Out of the Box' '32-bit' '64-bit') alignments=(left center center center) is_bools=(0 1 1 1) col1=($(code "${platforms[@]}")) col2=($(cmp_arrays ${#platforms[@]} "${platforms[@]}" "${ootb_platforms[@]}")) col3=($(cmp_arrays ${#platforms[@]} "${platforms[@]}" "${platforms_32[@]}")) col4=($(cmp_arrays ${#platforms[@]} "${platforms[@]}" "${platforms_64[@]}")) col_count=${#headers[@]} row_count=${#col1[@]} print_table 0 $col_count $row_count \ "${headers[@]}" "${alignments[@]}" ${is_bools[@]} \ "${col1[@]}" ${col2[@]} ${col3[@]} ${col4[@]} } grid_column() { prefix="$1/" base_column=($(add_prefix_to_array "$prefix" "${goarches[@]}")) filtered_column1=($(filter_array_by_prefix "$prefix" "${platforms[@]}")) filtered_column2=($(filter_array_by_prefix "$prefix" "${ootb_platforms[@]}")) col=($(cmp3_arrays ${#base_column[@]} "${base_column[@]}" "${#filtered_column1[@]}" "${filtered_column1[@]}" "${filtered_column2[@]}")) printf -- '%s\n' "${col[@]}" } print_support_grid_1() { oses=(android darwin ios js linux windows) headers=('' $(code "${oses[@]}") '') footers=('' $(bold_code "${oses[@]}") '') alignments=(right center center center center center center left) is_bools=(0 1 1 1 1 1 1 0) col1=($(bold_code "${goarches[@]}")) col2=($(grid_column "${oses[0]}")) col3=($(grid_column "${oses[1]}")) col4=($(grid_column "${oses[2]}")) col5=($(grid_column "${oses[3]}")) col6=($(grid_column "${oses[4]}")) col7=($(grid_column "${oses[5]}")) # col8=("${col1[@]}") col_count=${#headers[@]} row_count=${#col1[@]} print_table 1 $col_count $row_count \ "${headers[@]}" "${alignments[@]}" ${is_bools[@]} \ "${col1[@]}" ${col2[@]} ${col3[@]} ${col4[@]} \ ${col5[@]} ${col6[@]} ${col7[@]} "${col1[@]}" } print_support_grid_2() { oses=(aix dragonfly freebsd hurd illumos nacl netbsd openbsd plan9 solaris zos) oses_abbr=(a d f h i m n o p s z) headers=('' $(code "${oses_abbr[@]}") '') footers=('' $(bold_code "${oses_abbr[@]}") '') alignments=(right center center center center center center center center center center center left) is_bools=(0 1 1 1 1 1 1 1 1 1 1 1 0) col1=($(bold_code "${goarches[@]}")) col2=($(grid_column "${oses[0]}")) col3=($(grid_column "${oses[1]}")) col4=($(grid_column "${oses[2]}")) col5=($(grid_column "${oses[3]}")) col6=($(grid_column "${oses[4]}")) col7=($(grid_column "${oses[5]}")) col8=($(grid_column "${oses[6]}")) col9=($(grid_column "${oses[7]}")) col10=($(grid_column "${oses[8]}")) col11=($(grid_column "${oses[9]}")) col12=($(grid_column "${oses[10]}")) # col13=("${col1[@]}") col_count=${#headers[@]} row_count=${#col1[@]} print_table 1 $col_count $row_count \ "${headers[@]}" "${alignments[@]}" ${is_bools[@]} \ "${col1[@]}" ${col2[@]} ${col3[@]} ${col4[@]} \ ${col5[@]} ${col6[@]} ${col7[@]} ${col8[@]} \ ${col9[@]} ${col10[@]} ${col11[@]} ${col12[@]} \ "${col1[@]}" # Print Key printf -- '### Key\n' printf -- '\n' fmt='`%s` = `%s`' len=${#oses[@]} for ((i=0; i<len; i++)) do printf -- "$fmt" "${oses_abbr[i]}" "${oses[i]}" fmt=', `%s` = `%s`' done printf -- '\n\n' } ### printf -- '# Go (Golang) GOOS and GOARCH\n' printf -- '\n' printf -- 'All of the following information is based on `%s`.\n' "$(go version)" printf -- '\n' ### printf -- '## GOOS Values\n' printf -- '\n' print_gooses_table printf -- 'All GOOS values:\n' print_list "${gooses[@]}" printf -- '"Out of the box" GOOS values:\n' print_list "${ootb_gooses[@]}" printf -- '> 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 [make1.sh](#file-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 [make1.sh](#file-make1-sh) below. The "32-bit/64-bit" information is based on the result of [make2.sh](#file-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 [make1.sh](#file-make1-sh) below. The "32-bit/64-bit" information is based on the result of [make2.sh](#file-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' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,272 +1,297 @@ # Go (Golang) GOOS and GOARCH All of the following information is based on `go version go1.17.1 darwin/amd64`. ## GOOS Values | GOOS | Out of the Box | | :---------- | :------------: | | `aix` | ✅ | | `android` | ✅ | | `darwin` | ✅ | | `dragonfly` | ✅ | | `freebsd` | ✅ | | `hurd` | | | `illumos` | ✅ | | `ios` | ✅ | | `js` | ✅ | | `linux` | ✅ | | `nacl` | | | `netbsd` | ✅ | | `openbsd` | ✅ | | `plan9` | ✅ | | `solaris` | ✅ | | `windows` | ✅ | | `zos` | | All GOOS values: ```text "aix", "android", "darwin", "dragonfly", "freebsd", "hurd", "illumos", "ios", "js", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos" ``` "Out of the box" GOOS values: ```text "aix", "android", "darwin", "dragonfly", "freebsd", "illumos", "ios", "js", "linux", "netbsd", "openbsd", "plan9", "solaris", "windows" ``` > NOTE > > "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. > NOTE > > 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 [make1.sh](#file-make1-sh) below. ## GOARCH Values | GOARCH | Out of the Box | 32-bit | 64-bit | | :------------ | :------------: | :----: | :----: | | `386` | ✅ | ✅ | | | `amd64` | ✅ | | ✅ | | `amd64p32` | | ✅ | | | `arm` | ✅ | ✅ | | | `arm64` | ✅ | | ✅ | | `arm64be` | | | ✅ | | `armbe` | | ✅ | | | `loong64` | | | ✅ | | `mips` | ✅ | ✅ | | | `mips64` | ✅ | | ✅ | | `mips64le` | ✅ | | ✅ | | `mips64p32` | | ✅ | | | `mips64p32le` | | ✅ | | | `mipsle` | ✅ | ✅ | | | `ppc` | | ✅ | | | `ppc64` | ✅ | | ✅ | | `ppc64le` | ✅ | | ✅ | | `riscv` | | ✅ | | | `riscv64` | ✅ | | ✅ | | `s390` | | ✅ | | | `s390x` | ✅ | | ✅ | | `sparc` | | ✅ | | | `sparc64` | | | ✅ | | `wasm` | ✅ | | ✅ | All GOARCH values: ```text "386", "amd64", "amd64p32", "arm", "arm64", "arm64be", "armbe", "loong64", "mips", "mips64", "mips64le", "mips64p32", "mips64p32le", "mipsle", "ppc", "ppc64", "ppc64le", "riscv", "riscv64", "s390", "s390x", "sparc", "sparc64", "wasm" ``` All 32-bit GOARCH values: ```text "386", "amd64p32", "arm", "armbe", "mips", "mips64p32", "mips64p32le", "mipsle", "ppc", "riscv", "s390", "sparc" ``` All 64-bit GOARCH values: ```text "amd64", "arm64", "arm64be", "loong64", "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x", "sparc64", "wasm" ``` "Out of the box" GOARCH values: ```text "386", "amd64", "arm", "arm64", "mips", "mips64", "mips64le", "mipsle", "ppc64", "ppc64le", "riscv64", "s390x", "wasm" ``` "Out of the box" 32-bit GOARCH values: ```text "386", "arm", "mips", "mipsle" ``` "Out of the box" 64-bit GOARCH values: ```text "amd64", "arm64", "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x", "wasm" ``` > NOTE > > "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. > NOTE > > 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 [make1.sh](#file-make1-sh) below. The "32-bit/64-bit" information is based on the result of [make2.sh](#file-make2-sh) below and https://golang.org/doc/install/source. ## Platform Values | Platform | Out of the Box | 32-bit | 64-bit | | :---------------- | :------------: | :----: | :----: | | `aix/ppc64` | ✅ | | ✅ | | `android/386` | | ✅ | | | `android/amd64` | | | ✅ | | `android/arm` | | ✅ | | | `android/arm64` | ✅ | | ✅ | | `darwin/amd64` | ✅ | | ✅ | | `darwin/arm64` | ✅ | | ✅ | | `dragonfly/amd64` | ✅ | | ✅ | | `freebsd/386` | ✅ | ✅ | | | `freebsd/amd64` | ✅ | | ✅ | | `freebsd/arm` | ✅ | ✅ | | | `freebsd/arm64` | ✅ | | ✅ | | `illumos/amd64` | ✅ | | ✅ | | `ios/amd64` | ✅ | | ✅ | | `ios/arm64` | | | ✅ | | `js/wasm` | ✅ | | ✅ | | `linux/386` | ✅ | ✅ | | | `linux/amd64` | ✅ | | ✅ | | `linux/arm` | ✅ | ✅ | | | `linux/arm64` | ✅ | | ✅ | | `linux/mips` | ✅ | ✅ | | | `linux/mips64` | ✅ | | ✅ | | `linux/mips64le` | ✅ | | ✅ | | `linux/mipsle` | ✅ | ✅ | | | `linux/ppc64` | ✅ | | ✅ | | `linux/ppc64le` | ✅ | | ✅ | | `linux/riscv64` | ✅ | | ✅ | | `linux/s390x` | ✅ | | ✅ | | `netbsd/386` | ✅ | ✅ | | | `netbsd/amd64` | ✅ | | ✅ | | `netbsd/arm` | ✅ | ✅ | | | `netbsd/arm64` | ✅ | | ✅ | | `openbsd/386` | ✅ | ✅ | | | `openbsd/amd64` | ✅ | | ✅ | | `openbsd/arm` | ✅ | ✅ | | | `openbsd/arm64` | ✅ | | ✅ | | `openbsd/mips64` | ✅ | | ✅ | | `plan9/386` | ✅ | ✅ | | | `plan9/amd64` | ✅ | | ✅ | | `plan9/arm` | ✅ | ✅ | | | `solaris/amd64` | ✅ | | ✅ | | `windows/386` | ✅ | ✅ | | | `windows/amd64` | ✅ | | ✅ | | `windows/arm` | ✅ | ✅ | | | `windows/arm64` | ✅ | | ✅ | All Platform values: ```text "aix/ppc64", "android/386", "android/amd64", "android/arm", "android/arm64", "darwin/amd64", "darwin/arm64", "dragonfly/amd64", "freebsd/386", "freebsd/amd64", "freebsd/arm", "freebsd/arm64", "illumos/amd64", "ios/amd64", "ios/arm64", "js/wasm", "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/mips", "linux/mips64", "linux/mips64le", "linux/mipsle", "linux/ppc64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "netbsd/386", "netbsd/amd64", "netbsd/arm", "netbsd/arm64", "openbsd/386", "openbsd/amd64", "openbsd/arm", "openbsd/arm64", "openbsd/mips64", "plan9/386", "plan9/amd64", "plan9/arm", "solaris/amd64", "windows/386", "windows/amd64", "windows/arm", "windows/arm64" ``` All 32-bit Platform values: ```text "android/386", "android/arm", "freebsd/386", "freebsd/arm", "linux/386", "linux/arm", "linux/mips", "linux/mipsle", "netbsd/386", "netbsd/arm", "openbsd/386", "openbsd/arm", "plan9/386", "plan9/arm", "windows/386", "windows/arm" ``` All 64-bit Platform values: ```text "aix/ppc64", "android/amd64", "android/arm64", "darwin/amd64", "darwin/arm64", "dragonfly/amd64", "freebsd/amd64", "freebsd/arm64", "illumos/amd64", "ios/amd64", "ios/arm64", "js/wasm", "linux/amd64", "linux/arm64", "linux/mips64", "linux/mips64le", "linux/ppc64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "netbsd/amd64", "netbsd/arm64", "openbsd/amd64", "openbsd/arm64", "openbsd/mips64", "plan9/amd64", "solaris/amd64", "windows/amd64", "windows/arm64" ``` "Out of the box" Platform values: ```text "aix/ppc64", "android/arm64", "darwin/amd64", "darwin/arm64", "dragonfly/amd64", "freebsd/386", "freebsd/amd64", "freebsd/arm", "freebsd/arm64", "illumos/amd64", "ios/amd64", "js/wasm", "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/mips", "linux/mips64", "linux/mips64le", "linux/mipsle", "linux/ppc64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "netbsd/386", "netbsd/amd64", "netbsd/arm", "netbsd/arm64", "openbsd/386", "openbsd/amd64", "openbsd/arm", "openbsd/arm64", "openbsd/mips64", "plan9/386", "plan9/amd64", "plan9/arm", "solaris/amd64", "windows/386", "windows/amd64", "windows/arm", "windows/arm64" ``` "Out of the box" 32-bit Platform values: ```text "freebsd/386", "freebsd/arm", "linux/386", "linux/arm", "linux/mips", "linux/mipsle", "netbsd/386", "netbsd/arm", "openbsd/386", "openbsd/arm", "plan9/386", "plan9/arm", "windows/386", "windows/arm" ``` "Out of the box" 64-bit Platform values: ```text "aix/ppc64", "android/arm64", "darwin/amd64", "darwin/arm64", "dragonfly/amd64", "freebsd/amd64", "freebsd/arm64", "illumos/amd64", "ios/amd64", "js/wasm", "linux/amd64", "linux/arm64", "linux/mips64", "linux/mips64le", "linux/ppc64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "netbsd/amd64", "netbsd/arm64", "openbsd/amd64", "openbsd/arm64", "openbsd/mips64", "plan9/amd64", "solaris/amd64", "windows/amd64", "windows/arm64" ``` > NOTE > > "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. > NOTE > > 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 [make1.sh](#file-make1-sh) below. The "32-bit/64-bit" information is based on the result of [make2.sh](#file-make2-sh) below and https://golang.org/doc/install/source. ## Support Grid 1 | | `android` | `darwin` | `ios` | `js` | `linux` | `windows` | | | ----------------: | :-------: | :------: | :---: | :--: | :-----: | :-------: | :---------------- | | **`386`** | ☑️ (α1) | | | | ✅ | ✅ | **`386`** | | **`amd64`** | ☑️ (α2) | ✅ | ✅ | | ✅ | ✅ | **`amd64`** | | **`amd64p32`** | | | | | | | **`amd64p32`** | | **`arm`** | ☑️ (α2) | | | | ✅ | ✅ | **`arm`** | | **`arm64`** | ✅ | ✅ | ☑️ (β) | | ✅ | ✅ | **`arm64`** | | **`arm64be`** | | | | | | | **`arm64be`** | | **`armbe`** | | | | | | | **`armbe`** | | **`loong64`** | | | | | | | **`loong64`** | | **`mips`** | | | | | ✅ | | **`mips`** | | **`mips64`** | | | | | ✅ | | **`mips64`** | | **`mips64le`** | | | | | ✅ | | **`mips64le`** | | **`mips64p32`** | | | | | | | **`mips64p32`** | | **`mips64p32le`** | | | | | | | **`mips64p32le`** | | **`mipsle`** | | | | | ✅ | | **`mipsle`** | | **`ppc`** | | | | | | | **`ppc`** | | **`ppc64`** | | | | | ✅ | | **`ppc64`** | | **`ppc64le`** | | | | | ✅ | | **`ppc64le`** | | **`riscv`** | | | | | | | **`riscv`** | | **`riscv64`** | | | | | ✅ | | **`riscv64`** | | **`s390`** | | | | | | | **`s390`** | | **`s390x`** | | | | | ✅ | | **`s390x`** | | **`sparc`** | | | | | | | **`sparc`** | | **`sparc64`** | | | | | (γ) | | **`sparc64`** | | **`wasm`** | | | | ✅ | | | **`wasm`** | | | **`android`** | **`darwin`** | **`ios`** | **`js`** | **`linux`** | **`windows`** | | ## Support Grid 2 | | `a` | `d` | `f` | `h` | `i` | `m` | `n` | `o` | `p` | `s` | `z` | | | ----------------: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :---------------- | | **`386`** | | | ✅ | | | | ✅ | ✅ | ✅ | | | **`386`** | | **`amd64`** | | ✅ | ✅ | | ✅ | | ✅ | ✅ | ✅ | ✅ | | **`amd64`** | | **`amd64p32`** | | | | | | | | | | | | **`amd64p32`** | | **`arm`** | | | ✅ | | | | ✅ | ✅ | ✅ | | | **`arm`** | | **`arm64`** | | | ✅ | | | | ✅ | ✅ | | | | **`arm64`** | | **`arm64be`** | | | | | | | | | | | | **`arm64be`** | | **`armbe`** | | | | | | | | | | | | **`armbe`** | | **`loong64`** | | | | | | | | | | | | **`loong64`** | | **`mips`** | | | | | | | | | | | | **`mips`** | | **`mips64`** | | | | | | | | ✅ | | | | **`mips64`** | | **`mips64le`** | | | | | | | | | | | | **`mips64le`** | | **`mips64p32`** | | | | | | | | | | | | **`mips64p32`** | | **`mips64p32le`** | | | | | | | | | | | | **`mips64p32le`** | | **`mipsle`** | | | | | | | | | | | | **`mipsle`** | | **`ppc`** | | | | | | | | | | | | **`ppc`** | | **`ppc64`** | ✅ | | | | | | | | | | | **`ppc64`** | | **`ppc64le`** | | | | | | | | | | | | **`ppc64le`** | | **`riscv`** | | | | | | | | | | | | **`riscv`** | | **`riscv64`** | | | | | | | | | | | | **`riscv64`** | | **`s390`** | | | | | | | | | | | | **`s390`** | | **`s390x`** | | | | | | | | | | | | **`s390x`** | | **`sparc`** | | | | | | | | | | | | **`sparc`** | | **`sparc64`** | | | | | | | | | | | | **`sparc64`** | | **`wasm`** | | | | | | | | | | | | **`wasm`** | | | **`a`** | **`d`** | **`f`** | **`h`** | **`i`** | **`m`** | **`n`** | **`o`** | **`p`** | **`s`** | **`z`** | | ### Key `a` = `aix`, `d` = `dragonfly`, `f` = `freebsd`, `h` = `hurd`, `i` = `illumos`, `m` = `nacl`, `n` = `netbsd`, `o` = `openbsd`, `p` = `plan9`, `s` = `solaris`, `z` = `zos` ✅: Supported (out of the box) ☑️: Supported (with the help of a C compiler, etc.) (blank): Unsupported `α1`: ```text # command-line-arguments loadinternal: cannot find runtime/cgo /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] ld: unknown option: -z clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `α2`: ```text # command-line-arguments loadinternal: cannot find runtime/cgo /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: unknown option: -z clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `β`: ```text # command-line-arguments loadinternal: cannot find runtime/cgo /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: warning: ignoring file /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxxx/go.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64 Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable @@ -275,147 +300,35 @@ clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `γ`: ```text go tool compile: exit status 2 compile: unknown architecture "sparc64" ``` > NOTE > > The `nacl` GOOS was dropped since `go version 1.14` > > 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) > > Reference: https://golang.org/doc/go1.14#nacl > NOTE > > The `darwin/386` port was dropped since `go version 1.15` > > Reference: https://golang.org/doc/go1.15#darwin > NOTE > > On before `go version 1.16`: > - `darwin/amd64` means **macOS** > - `darwin/arm64` means **iOS** > > With the introduction of Apple Silicon (a.k.a. the M1 chip), on `go version 1.16` or later: > - `darwin/amd64` means **macOS** with Intel CPU > - `darwin/arm64` updates to mean **macOS** with Apple Silicon CPU > - `ios/amd64` is the new port for **iOS Simulator** on macOS with Intel CPU > - `ios/arm64` is the new port for **iOS** > > Reference: https://golang.org/doc/go1.16#darwin This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ package main func main() {} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ package main const ( hello uint = 0xfedcba9876543210 ) func main() {} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,78 @@ #!/bin/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)) ### # Results ootb_gooses=() ootb_goarches=() ootb_platforms=() for goos in "${gooses[@]}" do is_goos_ootb=0 for goarch in "${goarches[@]}" do GOOS="$goos" GOARCH="$goarch" go build -o /dev/null main1.go >out.log 2>err.log if [ $? -eq 0 ] then if [ $is_goos_ootb -eq 0 ] then ootb_gooses+=("$goos") is_goos_ootb=1 fi ootb_goarches+=("$goarch") ootb_platforms+=("$goos/$goarch") else if grep -qe '^cmd/go: unsupported GOOS/GOARCH pair' err.log then : else mv err.log $goos-$goarch.err.log fi fi if [ -s out.log ] then mv out.log $goos-$goarch.out.log fi done done ootb_goarches=($(printf -- '%s\n' "${ootb_goarches[@]}" | sort | uniq)) rm -f out.log err.log ### # Usage: # print_array $array_name print_array() { array_name="$1" array_ref="$array_name[@]" printf -- '%s=(\n' "$array_name" printf -- ' %s\n' "${!array_ref}" printf -- ')\n\n' } ### { print_array 'ootb_gooses' print_array 'ootb_goarches' print_array 'ootb_platforms' } > out1.sh This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ #!/bin/bash source out1.sh ### # Results ootb_goarches_32=() ootb_goarches_64=() ootb_platforms_32=() ootb_platforms_64=() for ootb_platform in "${ootb_platforms[@]}" do ootb_goos=${ootb_platform%/*} ootb_goarch=${ootb_platform#*/} GOOS="${ootb_goos}" GOARCH="${ootb_goarch}" go build -o /dev/null main2.go >/dev/null 2>&1 if [ $? -eq 0 ] then ootb_goarches_64+=(${ootb_goarch}) ootb_platforms_64+=(${ootb_platform}) else ootb_goarches_32+=(${ootb_goarch}) ootb_platforms_32+=(${ootb_platform}) fi done ootb_goarches_32=($(printf -- '%s\n' "${ootb_goarches_32[@]}" | sort | uniq)) ootb_goarches_64=($(printf -- '%s\n' "${ootb_goarches_64[@]}" | sort | uniq)) ### # Usage: # print_array $array_name print_array() { array_name="$1" array_ref="$array_name[@]" printf -- '%s=(\n' "$array_name" printf -- ' %s\n' "${!array_ref}" printf -- ')\n\n' } ### { print_array 'ootb_goarches_32' print_array 'ootb_goarches_64' print_array 'ootb_platforms_32' print_array 'ootb_platforms_64' } > out2.sh -
asukakenji revised this gist
Aug 10, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -200,7 +200,7 @@ All of the following information is based on `go version go1.14.7 darwin/amd64`. | **`wasm`** | | | `O` | | | | **`wasm`** | | | **`android`** | **`darwin`** | **`js`** | **`linux`** | **`nacl`** | **`windows`** | | > NOTE: `darwin` is essentially the same as **macOS** / **iOS** ( https://golang.org/doc/install/source ). > NOTE: `nacl` support was dropped since `go version 1.14`. -
asukakenji revised this gist
Aug 10, 2020 . 1 changed file with 52 additions and 50 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -173,63 +173,65 @@ All of the following information is based on `go version go1.14.7 darwin/amd64`. ## Support Grid 1 | | `android` | `darwin` | `js` | `linux` | `nacl` | `windows` | | | ----------------: | :-------: | :------: | :--: | :-----: | :----: | :-------: | :---------------- | | **`386`** | `α` | `O` | | `O` | | `O` | **`386`** | | **`amd64`** | `α` | `O` | | `O` | | `O` | **`amd64`** | | **`amd64p32`** | | | | | | | **`amd64p32`** | | **`arm`** | `α` | `β1` | | `O` | | `O` | **`arm`** | | **`armbe`** | | | | | | | **`armbe`** | | **`arm64`** | `α` | `β2` | | `O` | | | **`arm64`** | | **`arm64be`** | | | | | | | **`arm64be`** | | **`ppc64`** | | | | `O` | | | **`ppc64`** | | **`ppc64le`** | | | | `O` | | | **`ppc64le`** | | **`mips`** | | | | `O` | | | **`mips`** | | **`mipsle`** | | | | `O` | | | **`mipsle`** | | **`mips64`** | | | | `O` | | | **`mips64`** | | **`mips64le`** | | | | `O` | | | **`mips64le`** | | **`mips64p32`** | | | | | | | **`mips64p32`** | | **`mips64p32le`** | | | | | | | **`mips64p32le`** | | **`ppc`** | | | | | | | **`ppc`** | | **`riscv`** | | | | | | | **`riscv`** | | **`riscv64`** | | | | `O` | | | **`riscv64`** | | **`s390`** | | | | | | | **`s390`** | | **`s390x`** | | | | `O` | | | **`s390x`** | | **`sparc`** | | | | | | | **`sparc`** | | **`sparc64`** | | | | `γ` | | | **`sparc64`** | | **`wasm`** | | | `O` | | | | **`wasm`** | | | **`android`** | **`darwin`** | **`js`** | **`linux`** | **`nacl`** | **`windows`** | | > NOTE: `darwin` is essentially the same as **macOS**. > NOTE: `nacl` support was dropped since `go version 1.14`. ## Support Grid 2 | | `a` | `d` | `f` | `h` | `i` | `n` | `o` | `p` | `s` | `z` | | | ----------------: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :---------------- | | **`386`** | | | `O` | | | `O` | `O` | `O` | | | **`386`** | | **`amd64`** | | `O` | `O` | | `O` | `O` | `O` | `O` | `O` | | **`amd64`** | | **`amd64p32`** | | | | | | | | | | | **`amd64p32`** | | **`arm`** | | | `O` | | | `O` | `O` | `O` | | | **`arm`** | | **`armbe`** | | | | | | | | | | | **`armbe`** | | **`arm64`** | | | `O` | | | `O` | `O` | | | | **`arm64`** | | **`arm64be`** | | | | | | | | | | | **`arm64be`** | | **`ppc64`** | `O` | | | | | | | | | | **`ppc64`** | | **`ppc64le`** | | | | | | | | | | | **`ppc64le`** | | **`mips`** | | | | | | | | | | | **`mips`** | | **`mipsle`** | | | | | | | | | | | **`mipsle`** | | **`mips64`** | | | | | | | | | | | **`mips64`** | | **`mips64le`** | | | | | | | | | | | **`mips64le`** | | **`mips64p32`** | | | | | | | | | | | **`mips64p32`** | | **`mips64p32le`** | | | | | | | | | | | **`mips64p32le`** | | **`ppc`** | | | | | | | | | | | **`ppc`** | | **`riscv`** | | | | | | | | | | | **`riscv`** | | **`riscv64`** | | | | | | | | | | | **`riscv64`** | | **`s390`** | | | | | | | | | | | **`s390`** | | **`s390x`** | | | | | | | | | | | **`s390x`** | | **`sparc`** | | | | | | | | | | | **`sparc`** | | **`sparc64`** | | | | | | | | | | | **`sparc64`** | | **`wasm`** | | | | | | | | | | | **`wasm`** | | | **`a`** | **`d`** | **`f`** | **`h`** | **`i`** | **`n`** | **`o`** | **`p`** | **`s`** | **`z`** | ### Key -
asukakenji revised this gist
Aug 10, 2020 . 1 changed file with 130 additions and 51 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,37 @@ # Go (Golang) GOOS and GOARCH All of the following information is based on `go version go1.14.7 darwin/amd64`. ## A list of valid GOOS values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - **`aix`** - `android` - **`darwin`** - **`dragonfly`** - **`freebsd`** - `hurd` - **`illumos`** - **`js`** - **`linux`** - `nacl` - **`netbsd`** - **`openbsd`** - **`plan9`** - **`solaris`** - **`windows`** - `zos` > NOTE: `nacl` support was dropped since `go version 1.14`. ## A list of valid GOARCH values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - **`386`** - **`amd64`** - `amd64p32` - **`arm`** - `armbe` - **`arm64`** @@ -39,24 +45,30 @@ All of the following information is based on `go version go1.8.3 darwin/amd64`. - `mips64p32` - `mips64p32le` - `ppc` - `riscv` - **`riscv64`** - `s390` - **`s390x`** - `sparc` - `sparc64` - **`wasm`** > NOTE: The `amd64p32` GOARCH, which is related to the `nacl` GOOS, was dropped since `go version 1.14`. ## A list of valid 32-bit GOARCH values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - **`386`** - `amd64p32` - **`arm`** - `armbe` - **`mips`** - **`mipsle`** - `mips64p32` - `mips64p32le` - `ppc` - `riscv` - `s390` - `sparc` @@ -71,17 +83,23 @@ All of the following information is based on `go version go1.8.3 darwin/amd64`. - **`ppc64le`** - **`mips64`** - **`mips64le`** - **`riscv64`** - **`s390x`** - `sparc64` - **`wasm`** ## A list of GOOS/GOARCH supported by `go` out of the box - `aix/ppc64` - `darwin/386` - `darwin/amd64` - `dragonfly/amd64` - `freebsd/386` - `freebsd/amd64` - `freebsd/arm` - `freebsd/arm64` - `illumos/amd64` - `js/wasm` - `linux/386` - `linux/amd64` - `linux/arm` @@ -92,22 +110,23 @@ All of the following information is based on `go version go1.8.3 darwin/amd64`. - `linux/mipsle` - `linux/mips64` - `linux/mips64le` - `linux/riscv64` - `linux/s390x` - `netbsd/386` - `netbsd/amd64` - `netbsd/arm` - `netbsd/arm64` - `openbsd/386` - `openbsd/amd64` - `openbsd/arm` - `openbsd/arm64` - `plan9/386` - `plan9/amd64` - `plan9/arm` - `solaris/amd64` - `windows/386` - `windows/amd64` - `windows/arm` ## A list of 32-bit GOOS/GOARCH supported by `go` out of the box @@ -118,102 +137,149 @@ All of the following information is based on `go version go1.8.3 darwin/amd64`. - `linux/arm` - `linux/mips` - `linux/mipsle` - `netbsd/386` - `netbsd/arm` - `openbsd/386` - `openbsd/arm` - `plan9/386` - `plan9/arm` - `windows/386` - `windows/arm` ## A list of 64-bit GOOS/GOARCH supported by `go` out of the box - `aix/ppc64` - `darwin/amd64` - `dragonfly/amd64` - `freebsd/amd64` - `freebsd/arm64` - `illumos/amd64` - `js/wasm` - `linux/amd64` - `linux/arm64` - `linux/ppc64` - `linux/ppc64le` - `linux/mips64` - `linux/mips64le` - `linux/riscv64` - `linux/s390x` - `netbsd/amd64` - `netbsd/arm64` - `openbsd/amd64` - `openbsd/arm64` - `plan9/amd64` - `solaris/amd64` - `windows/amd64` ## Support Grid 1 | | `android` | `darwin` | `js` | `linux` | `nacl` | `windows` | | ----------------- | --------- | -------- | ---- | ------- | ------ | --------- | | **`386`** | `α` | `O` | | `O` | | `O` | | **`amd64`** | `α` | `O` | | `O` | | `O` | | **`amd64p32`** | | | | | | | | **`arm`** | `α` | `β1` | | `O` | | `O` | | **`armbe`** | | | | | | | | **`arm64`** | `α` | `β2` | | `O` | | | | **`arm64be`** | | | | | | | | **`ppc64`** | | | | `O` | | | | **`ppc64le`** | | | | `O` | | | | **`mips`** | | | | `O` | | | | **`mipsle`** | | | | `O` | | | | **`mips64`** | | | | `O` | | | | **`mips64le`** | | | | `O` | | | | **`mips64p32`** | | | | | | | | **`mips64p32le`** | | | | | | | | **`ppc`** | | | | | | | | **`riscv`** | | | | | | | | **`riscv64`** | | | | `O` | | | | **`s390`** | | | | | | | | **`s390x`** | | | | `O` | | | | **`sparc`** | | | | | | | | **`sparc64`** | | | | `γ` | | | | **`wasm`** | | | `O` | | | | > NOTE: `darwin` is essentially the same as **macOS**. > NOTE: `nacl` support was dropped since `go version 1.14`. ## Support Grid 2 | | `a` | `d` | `f` | `h` | `i` | `n` | `o` | `p` | `s` | `z` | | ----------------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | **`386`** | | | `O` | | | `O` | `O` | `O` | | | | **`amd64`** | | `O` | `O` | | `O` | `O` | `O` | `O` | `O` | | | **`amd64p32`** | | | | | | | | | | | | **`arm`** | | | `O` | | | `O` | `O` | `O` | | | | **`armbe`** | | | | | | | | | | | | **`arm64`** | | | `O` | | | `O` | `O` | | | | | **`arm64be`** | | | | | | | | | | | | **`ppc64`** | `O` | | | | | | | | | | | **`ppc64le`** | | | | | | | | | | | | **`mips`** | | | | | | | | | | | | **`mipsle`** | | | | | | | | | | | | **`mips64`** | | | | | | | | | | | | **`mips64le`** | | | | | | | | | | | | **`mips64p32`** | | | | | | | | | | | | **`mips64p32le`** | | | | | | | | | | | | **`ppc`** | | | | | | | | | | | | **`riscv`** | | | | | | | | | | | | **`riscv64`** | | | | | | | | | | | | **`s390`** | | | | | | | | | | | | **`s390x`** | | | | | | | | | | | | **`sparc`** | | | | | | | | | | | | **`sparc64`** | | | | | | | | | | | | **`wasm`** | | | | | | | | | | | ### Key `a` = `aix`, `d` = `dragonfly`, `f` = `freebsd`, `h` = `hurd`, `i` = `illumos`, `n` = `netbsd`, `o` = `openbsd`, `p` = `plan9`, `s` = `solaris`, `z` = `zos` (blank): Unsupported `O`: Supported `α`: ``` # command-line-arguments /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: unknown option: -z clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `β1`: ``` # command-line-arguments /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: warning: ignoring file /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxx/go.o, building for macOS-x86_64 but attempting to link with file built for unknown-armv7 Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `β2`: ``` # command-line-arguments /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: warning: ignoring file /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxx/go.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64 Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `γ`: ``` go tool compile: exit status 2 compile: unknown architecture "sparc64" go tool compile: exit status 2 compile: unknown architecture "sparc64" ``` ## Source 1 ### main.go @@ -233,11 +299,16 @@ os_archs=() # Reference: # https://github.com/golang/go/blob/master/src/go/build/syslist.go for goos in aix android darwin dragonfly freebsd hurd illumos js \ linux nacl netbsd openbsd plan9 solaris windows zos do for goarch in 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 \ ppc64le mips mipsle mips64 mips64le mips64p32 \ mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm do echo "--------" echo "${goos}/${goarch}" echo "--------" GOOS=${goos} GOARCH=${goarch} go build -o /dev/null main.go >/dev/null 2>&1 if [ $? -eq 0 ] then @@ -246,6 +317,9 @@ do done done echo echo "================" echo for os_arch in "${os_archs[@]}" do echo ${os_arch} @@ -274,12 +348,16 @@ func main() {} # Reference: # https://github.com/golang/go/blob/master/src/go/build/syslist.go os_archs=( aix/ppc64 darwin/386 darwin/amd64 dragonfly/amd64 freebsd/386 freebsd/amd64 freebsd/arm freebsd/arm64 illumos/amd64 js/wasm linux/386 linux/amd64 linux/arm @@ -290,22 +368,23 @@ os_archs=( linux/mipsle linux/mips64 linux/mips64le linux/riscv64 linux/s390x netbsd/386 netbsd/amd64 netbsd/arm netbsd/arm64 openbsd/386 openbsd/amd64 openbsd/arm openbsd/arm64 plan9/386 plan9/amd64 plan9/arm solaris/amd64 windows/386 windows/amd64 windows/arm ) os_archs_32=() -
asukakenji revised this gist
Sep 8, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Go (Golang) GOOS and GOARCH All of the following information is based on `go version go1.8.3 darwin/amd64`. ## A list of valid GOOS values -
asukakenji created this gist
Sep 8, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,340 @@ # Go (Golang) GOOS and GOARCH All of the following information were gathered on `go version go1.8.3 darwin/amd64`. ## A list of valid GOOS values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - `android` - **`darwin`** - **`dragonfly`** - **`freebsd`** - **`linux`** - **`nacl`** - **`netbsd`** - **`openbsd`** - **`plan9`** - **`solaris`** - **`windows`** - `zos` ## A list of valid GOARCH values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - **`386`** - **`amd64`** - **`amd64p32`** - **`arm`** - `armbe` - **`arm64`** - `arm64be` - **`ppc64`** - **`ppc64le`** - **`mips`** - **`mipsle`** - **`mips64`** - **`mips64le`** - `mips64p32` - `mips64p32le` - `ppc` - `s390` - **`s390x`** - `sparc` - `sparc64` ## A list of valid 32-bit GOARCH values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - **`386`** - **`amd64p32`** - **`arm`** - `armbe` - **`mips`** - **`mipsle`** - `mips64p32` - `mips64p32le` - `ppc` - `s390` - `sparc` ## A list of valid 64-bit GOARCH values (Bold = supported by `go` out of the box, ie. without the help of a C compiler, etc.) - **`amd64`** - **`arm64`** - `arm64be` - **`ppc64`** - **`ppc64le`** - **`mips64`** - **`mips64le`** - **`s390x`** - `sparc64` ## A list of GOOS/GOARCH supported by `go` out of the box - `darwin/386` - `darwin/amd64` - `dragonfly/amd64` - `freebsd/386` - `freebsd/amd64` - `freebsd/arm` - `linux/386` - `linux/amd64` - `linux/arm` - `linux/arm64` - `linux/ppc64` - `linux/ppc64le` - `linux/mips` - `linux/mipsle` - `linux/mips64` - `linux/mips64le` - `linux/s390x` - `nacl/386` - `nacl/amd64p32` - `nacl/arm` - `netbsd/386` - `netbsd/amd64` - `netbsd/arm` - `openbsd/386` - `openbsd/amd64` - `openbsd/arm` - `plan9/386` - `plan9/amd64` - `plan9/arm` - `solaris/amd64` - `windows/386` - `windows/amd64` ## A list of 32-bit GOOS/GOARCH supported by `go` out of the box - `darwin/386` - `freebsd/386` - `freebsd/arm` - `linux/386` - `linux/arm` - `linux/mips` - `linux/mipsle` - `nacl/386` - `nacl/amd64p32` - `nacl/arm` - `netbsd/386` - `netbsd/arm` - `openbsd/386` - `openbsd/arm` - `plan9/386` - `plan9/arm` - `windows/386` ## A list of 64-bit GOOS/GOARCH supported by `go` out of the box - `darwin/amd64` - `dragonfly/amd64` - `freebsd/amd64` - `linux/amd64` - `linux/arm64` - `linux/ppc64` - `linux/ppc64le` - `linux/mips64` - `linux/mips64le` - `linux/s390x` - `netbsd/amd64` - `openbsd/amd64` - `plan9/amd64` - `solaris/amd64` - `windows/amd64` ## Support Grid | | `a` | `m` | `d` | `f` | `l` | `c` | `n` | `o` | `p` | `s` | `w` | `z` | | ----------------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | **`386`** | `A` | `O` | | `O` | `O` | `O` | `O` | `O` | `O` | | `O` | | | **`amd64`** | `A` | `O` | `O` | `O` | `O` | | `O` | `O` | `O` | `O` | `O` | | | **`amd64p32`** | | | | | | `O` | | | | | | | | **`arm`** | `A` | `B` | | `O` | `O` | `O` | `O` | `O` | `O` | | | | | **`armbe`** | | | | | | | | | | | | | | **`arm64`** | `A` | `C` | | | `O` | | | | | | | | | **`arm64be`** | | | | | | | | | | | | | | **`ppc64`** | | | | | `O` | | | | | | | | | **`ppc64le`** | | | | | `O` | | | | | | | | | **`mips`** | | | | | `O` | | | | | | | | | **`mipsle`** | | | | | `O` | | | | | | | | | **`mips64`** | | | | | `O` | | | | | | | | | **`mips64le`** | | | | | `O` | | | | | | | | | **`mips64p32`** | | | | | | | | | | | | | | **`mips64p32le`** | | | | | | | | | | | | | | **`ppc`** | | | | | | | | | | | | | | **`s390`** | | | | | | | | | | | | | | **`s390x`** | | | | | `O` | | | | | | | | | **`sparc`** | | | | | | | | | | | | | | **`sparc64`** | | | | | | | | | | | | | ### Key `a` = `android`, `m` = `darwin` (`macos`), `d` = `dragonfly`, `f` = `freebsd`, `l` = `linux`, `c` = `nacl`, `n` = `netbsd`, `o` = `openbsd`, `p` = `plan9`, `s` = `solaris`, `w` = `windows`, `z` = `zos` (blank): Unsupported `O`: Supported `A`: ``` warning: unable to find runtime/cgo.a /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: unknown option: -z clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `B`: ``` warning: unable to find runtime/cgo.a /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: warning: ignoring file /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxx/go.o, file was built for armv7 which is not the architecture being linked (x86_64): /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxx/go.o Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` `C`: ``` warning: unable to find runtime/cgo.a /usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: warning: ignoring file /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxx/go.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x0C 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /var/folders/dd/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/go-link-xxxxxxxxx/go.o Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` ## Source 1 ### main.go ```go package main func main() {} ``` ### make.sh ```sh #!/bin/sh os_archs=() # Reference: # https://github.com/golang/go/blob/master/src/go/build/syslist.go for goos in android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos do for goarch in 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips \ mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 do GOOS=${goos} GOARCH=${goarch} go build -o /dev/null main.go >/dev/null 2>&1 if [ $? -eq 0 ] then os_archs+=("${goos}/${goarch}") fi done done for os_arch in "${os_archs[@]}" do echo ${os_arch} done ``` ## Source 2 ### main.go ```go package main const ( hello uint = 0xfedcba9876543210 ) func main() {} ``` ### make.sh ```sh #!/bin/bash # Reference: # https://github.com/golang/go/blob/master/src/go/build/syslist.go os_archs=( darwin/386 darwin/amd64 dragonfly/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/ppc64 linux/ppc64le linux/mips linux/mipsle linux/mips64 linux/mips64le linux/s390x nacl/386 nacl/amd64p32 nacl/arm netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 openbsd/arm plan9/386 plan9/amd64 plan9/arm solaris/amd64 windows/386 windows/amd64 ) os_archs_32=() os_archs_64=() for os_arch in "${os_archs[@]}" do goos=${os_arch%/*} goarch=${os_arch#*/} GOOS=${goos} GOARCH=${goarch} go build -o /dev/null main.go >/dev/null 2>&1 if [ $? -eq 0 ] then os_archs_64+=(${os_arch}) else os_archs_32+=(${os_arch}) fi done echo "32-bit:" for os_arch in "${os_archs_32[@]}" do printf "\t%s\n" "${os_arch}" done echo echo "64-bit:" for os_arch in "${os_archs_64[@]}" do printf "\t%s\n" "${os_arch}" done echo ```