Previously, the Go Lang environment was set up on Windows. Recently, we need to build the environment on Linux. However, due to the company's need for proxy for Internet access, the download of Go source code with Hg is always unavailable, so another method is selected. Mercurial windows is installed on Windows systems (without proxy) at home. Windows is relatively simple to install, and other dependent software, such as docutils, is not required in advance, python. Now let's record the general process:
1. Download and install mercurial's windows((mercurial-2.1.exe). During installation, You must select the environment variable hook.
: Http://mercurial.selenic.com/downloads/
2. Modify the username line in the mercurial. ini file in the mercurial installation directory and change it to your username and email.
3. You can use Hg in the CMD command line to download the go source code.
Command: Hg clone-u release https://go.googlecode.com/hg/ go
4. Upload the downloaded source code to the Linux server.
5. Then you can install go.
$ CD go/src
$./All. Bash
If the installation succeeds, a message similar to this will appear, indicating that the installation is successful.
ALL TESTS PASSED---Installed Go for linux/amd64 in /home/you/go.Installed commands in /home/you/go/bin.*** You need to add /home/you/go/bin to your $PATH. ***The compiler is 6g.
The shell file cannot be executed due to permission issues. You need to modify the command: chmod-r u + X ./*
6. You need to modify the environment variable.
Add it to the. bashrc file, which is roughly as follows. You must modify different go directories:
export GOROOT=$HOME/software/goexport GOARCH=amd64export GOOS=linuxexport GOBIN=$HOME/software/go/binexport PATH=$PATH:$GOBIN
After modifying. bashrc, run the environment variable file source. bashrc and Test 6 GB,
Indicates that the go environment is successfully set up.
7. Test the go language.
$ cat >hello.go <<EOFpackage mainimport "fmt"func main() {fmt.Printf("hello, world\n")}EOF$ 6g hello.go$ 6l hello.6$ ./6.outhello, world$
8. Vim plug-in support, including the go language syntax highlighting, filetype, automatic indent, and godoc functions;
CP-RF $ goroot/MISC/Vim ~ /. Vim
Modify ~ /. Vimrc, add in it
Filetype plugin indent on
Syntax on
To make some changes to the Go language in the future, you can add every file in $ goroot/MISC/Vim ~ /. Vim.
9. As the go language does not have a fixed version yet, the current gocode cannot be compiled successfully using the latest go language, therefore, there is no way to provide auto-completion and other functions in Vim. We hope that Google will release a fixed version as soon as possible, and gocode will be able to keep up with Go changes ..................