Goroot and Gopath

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

GOROOTGothe installation directory that points to the development package. From Go 1.0 the beginning, you do not have to display the GOROOT environment variables. The Windows installation package will be set up automatically and is installed GOROOT by default in C:\Go :

GOROOT=C:\Go\

In the *nix environment, download the Go installation package and unzip it in the /usr/local/ directory, then /usr/local/go/bin Add the PATH environment variables:

PATH=$PATH:/usr/local/go/bin  

If the Go installation package is not installed in the default directory ( Windows for C:\Go , *nix for /usr/local/go ), you need to set it manually, for GOROOT example ( *nix ):

export GOROOT=$HOME/go

GOPATHThe Go project directory, containing src , pkg and bin three subdirectories are specified. This is the Go only environment variable that needs to display settings when the program is developed. When go get you download a Go third-party package by using a directory, it is also installed in this directory. Also, for convenience, remember to $GOPATH/bin add to the PATH environment variable:

export PATH=$PATH:$GOPATH/bin  

In addition, according to the recommendation of this post, set a GoPATH sufficient.

Resources:

1. Easy Go programming Setup for Windows;
2. You don ' t need to set goroot, really;
3. How to Write Go Code;
4. Go Getting Started.

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.