Go language: Some environment variables

Source: Internet
Author: User

Not directly translated.

The Go compilation environment can be customized by environment variables. None is requiredby the build, but wish to set some to override the defaults.

  • $GOROOT

    The root of the Go tree, often $HOME/go . Its value is built into the tree when it's compiled, and defaults to the parent of the directory where was all.bash run. There is no need to set this unless you want to switch between multiple local copies of the repository.

  • $GOROOT_FINAL

    The value assumed by installed binaries, and scripts when are not $GOROOT set explicitly. It defaults to the value of $GOROOT . If you want to build the Go tree on one location but move it elsewhere after the build, set to the $GOROOT_FINAL eventual location .

  • $GOOSand$GOARCH

    The name of the target operating system and compilation architecture. These default to the values of $GOHOSTOS and $GOHOSTARCH respectively (described below).

    Choices for $GOOS is darwin (Mac OS X 10.6 and above),,,,,,, dragonfly freebsd linux netbsd openbsd plan9 and solaris windows . Choices for $GOARCH is amd64 (64-bit x86, the most mature port), 386 (32-bit x86), and arm (32-bit ARM). The valid combinations of and are $GOOS $GOARCH :

    $GOOS $GOARCH
    darwin 386
    darwin amd64
    dragonfly 386
    dragonfly amd64
    freebsd 386
    freebsd amd64
    freebsd arm
    linux 386
    linux amd64
    linux arm
    netbsd 386
    netbsd amd64
    netbsd arm
    openbsd 386
    openbsd amd64
    plan9 386
    plan9 amd64
    solaris amd64
    windows 386
    windows amd64
  • $GOHOSTOSand$GOHOSTARCH

    The name of the host operating system and compilation architecture. These default to the local system ' s operating system and architecture.

    Valid Choices $GOOS $GOARCH is the same as for and, listed above. The specified values must is compatible with the local system. For example, you should the not set to on an $GOHOSTARCH arm x86 system.

  • $GOBIN

    The location where Go binaries would be installed. The default is $GOROOT/bin . After installing, you'll want to arrange-to-add this directory $PATH to your and so can use the tools. If $GOBIN is set, the GO command installs all commands there.

Go language: Some environment variables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.