打印所有的 GOOS 和 GOARCH

Go 语言作为一种可以轻松交叉编译的语言,可以直接通过环境变量 GOOS 和 GOARCH 就可以了,但是 GOOS 和 GOARCH 分别有哪些值可以选?本文将介绍一下快速的查看方法。

  1. [root@liqiang.io]# go tool dist list
  2. aix/ppc64
  3. android/386
  4. android/amd64
  5. android/arm
  6. android/arm64
  7. darwin/386
  8. darwin/amd64
  9. darwin/arm
  10. darwin/arm64
  11. dragonfly/amd64
  12. freebsd/386
  13. freebsd/amd64
  14. freebsd/arm
  15. illumos/amd64
  16. js/wasm
  17. linux/386
  18. linux/amd64
  19. linux/arm
  20. linux/arm64
  21. linux/mips
  22. linux/mips64
  23. linux/mips64le
  24. linux/mipsle
  25. linux/ppc64
  26. linux/ppc64le
  27. linux/s390x
  28. nacl/386
  29. nacl/amd64p32
  30. nacl/arm
  31. netbsd/386
  32. netbsd/amd64
  33. netbsd/arm
  34. netbsd/arm64
  35. openbsd/386
  36. openbsd/amd64
  37. openbsd/arm
  38. openbsd/arm64
  39. plan9/386
  40. plan9/amd64
  41. plan9/arm
  42. solaris/amd64
  43. windows/386
  44. windows/amd64
  45. windows/arm

打印 Go 的所有 gcflags

  1. [root@liqiang.io]# go tool compile -help
  2. usage: compile [options] file.go...
  3. -% debug non-static initializers
  4. -+ compiling runtime
  5. -B disable bounds checking
  6. -C disable printing of columns in error messages
  7. -D path
  8. set relative path for local imports
  9. -E debug symbol export
  10. -I directory
  11. add directory to import search path
  12. -K debug missing line numbers
  13. -L show full file names in error messages
  14. -N disable optimizations
  15. -S print assembly listing
  16. -V print version and exit
  17. -W debug parse tree after type checking
  18. -asmhdr file
  19. write assembly header to file
  20. -bench file
  21. append benchmark times to file
  22. -blockprofile file
  23. write block profile to file
  24. -buildid id
  25. record id as the build id in the export metadata
  26. -c int
  27. concurrency during compilation, 1 means no concurrency (default 1)
  28. -complete
  29. compiling complete package (no C or assembly)
  30. -cpuprofile file
  31. write cpu profile to file
  32. -d list
  33. print debug information about items in list; try -d help
  34. -dwarf
  35. generate DWARF symbols (default true)
  36. -dwarfbasentries
  37. use base address selection entries in DWARF (default true)
  38. -dwarflocationlists
  39. add location lists to DWARF in optimized mode (default true)
  40. -dynlink
  41. support references to Go symbols defined in other shared libraries
  42. -e no limit on number of errors reported
  43. -embedcfg file
  44. read go:embed configuration from file
  45. -gendwarfinl int
  46. generate DWARF inline info records (default 2)
  47. -goversion string
  48. required version of the runtime
  49. -h halt on error
  50. -importcfg file
  51. read import configuration from file