This is a creation in Article, where the information may have evolved or changed. Use Google's official Go language installation package under Mac: Https://code.google.com/p/go/downloads/list installed Go ,The/usr/local/go/bin directory is automatically added to the path. This allows us to execute some of the go language commands directly from the console. http://golang.org/cmd/go/#hdr- Gopath_environment_variable http://www.cnblogs.com/ghj1976/archive/2013/01/16/2863142.html Go Binary compilation package Suppose you put go on/usr/ Local/go (or window is c:\Go) directory. Of course you can also install in other directories ,But this time, you need to set GorootEnvironment variables. Http://golang.org/doc/install#install for example ,If you install go in your/usr/local/go directory ,You should add the following settings to the $home/.profile file. Export Goroot=/usr/local/go Export Gopath= $PATH: $ Goroot/bin execution: source. Bash_profile (immediate effect) window is: under Windows ,May SetEnvironment variables through the & #34; Environment variables& #34; button on the & #34; advanced& #34; tab of the & #34; system& #34; Control Panel. Some versions of Windows provide this control panel through the & #34; Advanced System settings& #34; Option inside the & #34; system& #34; Control Panel. Like my Mac Ben. ,Actually I didn't set Goroot,But with Go env you get GorootThe directory is:/usr/local/go I guess this should be the default setting when there is no setting. If there is a setting ,Will overwrite. Gopathgopathis to tell the GO command and other related tools ,Where to find the Go pack installed on your system. Gopathis a list of paths ,A typical GopathSet the following ,Settings similar to Path ,Win next with a semicolon split: Gopath=/home/user/ext:/home/user/ MygoThe path in each list is the location of a workspace. Each workspace has a source file, an object for the related package, and an execution file. Http://golang.org/doc/code.html below is a step for creating a workspace: Create a $HOME/ MygoDirectory and the SRC directory as the source code. $ mkdir-p $HOME/ Mygo/SRC # Create a place toPut source code The next step is to set Gopath,In addition, you should put the bin directory under this directory in the PATH environment variable ,This allows you to execute directly on the command line without giving the full directory. Export Gopath= $HOME/ MygoExport path= $PATH: $HOME/ Mygo/bin GopathThe compilation and installation package must be set ,Even with the standard go directory tree ,Similar to the following: Gopath=/home/user/gocode/home/user/gocode/src/foo/bar/(go code in Package bar) X.go quux/(go Code on package main) Y.go BI N/quux (Installed command) PKG/LINUX_AMD64/FOO/BAR.A (installed package object) http://golang.org/cmd/go/#hdr- Gopath_environment_variable
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