LINUX/MAC GO environment variable configuration

Source: Internet
Author: User

After installing the Go language, but also to set the path, if you do not set the path, the execution of Go will prompt Go:command not found, the hint means that there is no command line. This is because the path is not set yet.

The way to set the path is vi ~/.bash_profile, go in the first line to add a row of export path= $PATH:/usr/local/go/bin, you can.

Then make the profile effective: source ~/.bash_profile

1, Goroot is the Go installation path

2, Gopath

    • go install/ go get and go tools are used to gopath environment variables.
    • Gopath is the search path as the compiled binary storage destination and import package (in fact your working directory, you can create your own go source file under SRC and then start working).
      1. Gopath consists of three main directories: bin, pkg, SRC
      2. The bin directory mainly contains executable files; Pkg directory to store compiled library files, mainly *.a files; The source files of go are mainly stored in the SRC directory.
    • Do not set the Gopath as the Go installation path

LINUX/MAC GO environment variable configuration

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.