Goroot Gopath GO GET

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

1. Goroot Gopath and PATH Setup


A. adding a system variable Goroot: The first thing you do when you install Go is set up goroot. For example, my Go installation is in C:\Go, set goroot = C:\Go


B. modify the Environment change path: Add the%goroot%\bin to the environment variable path, this can be directly in the DOS command mode in the operation of any%goroot%\bin program such as: Go.exe Godoc.exe


C. add a system variable Gopath: Gopath is an important change in the way the package is loaded. You can set multiple paths, separated by a dividing number (;).

For example my gopath = D:\data\golang\letsgo; D:\data\golang; D:\data\golang\beego;d:\data\golang\beeweb;

I import a non-existent xxx bag

The following mistakes are reported ( the important role of Gopath in package loading ):


Note: The source code of the package to be loaded must be placed in the Gopath path of the src Catalog, or it is not prompted to download the package


2. Go get download Source system


There are various dependencies in the general source project, and a Fock is too troublesome. Try the go get command.


Below I use go get to obtain a source blogging system (Github.com/lisijie/goblog) on GitHub:


1. Set the project path to Gopath (at the front of Gopath, go get will download the code to the first item in the Gopath)

such as: I downloaded the blog system to D:\data\golang\goblog, Gopath = D:\data\golang\goblog;d:\data\golang\letsgo; D:\data\golang; D:\data\golang\beego;d:\data\golang\beeweb;

Note: If you have a git shell reboot to restart the Git shell, the Gopath setup is not yet in effect ...

2. Run the go get github.com/lisijie/goblog in git shell for a few minutes ...


3. Enter the D:\data\golang\goblog to see the next download code.


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.