This article includes: 1) Install the Go language. 2) Run the first go language. 3) Added support for the go language in vim.
1. Install the Go language
This article uses the source to install the go language, the Go Language source code in the Baidu net disk Http://pan.baidu.com/s/1mguZqhM
1.1. Modify Environment variables
Edit File ~/.BASHRC
Vim ~/.bashre
Add the following code at the end of the file
# about Go languageexport goroot= $HOME/goexport goarch=386export GOOS= Linuxexport GOBIN
1.4. Decompression
Tar xzf go1. 3.3. linux-386.tar.gz$lsgogo1 . 3.3. linux-386. tar.gz
1.5. Move the Go directory to the home directory
MV Go ~/
1.6. Compiling
CD ~/go/src. /all.bash
"Checking API compatibility" may be stuck for a while ...
1.7. After compiling, start testing the result of compilation, execute the following code
$ go Versiongo version go1. 3.3 linux/386
As you can see, our go language version is 1.3.3
2. Start our first Go language program below
2.1, the program code is as follows
Package main import ( "fmt" "runtime" ) func main () { fmt. Println ("hellow world! " , runtime. Version ())}
2.2. Operation
$ go Run aa.go hellowworld! Go1. 3.3
3, to the present, our go language can be run, ah ~ AH ~
3.1. Increased support for go language in vim
Enter our go source code directory, LS View, will find the following directories and files
$ cd ~/go/misc/vim/$ lsautoload compiler ftdetect ftplugin indent plugin readme.txt Syntax
View the directory for Vim configuration in the system
$ ls/usr/share/vim/vim73/autoload delmenu.vim ftoff.vim gvimrc_example.vim Lang plugin synmenu.vimbugreport.vim doc ftplugin Indent macros print syntaxcolors evim.vim ftplugin.vim Indent.vim menu.vim rgb.txt tutorcompiler filetype.vim ftplugof.vim Indoff.vim mswin.vim scripts.vim vimrc_example.vimdebian.vim ftdetect go keymap Optwin.vim Spell
We will send first, which has the directory or file corresponding to the go directory, will download the directory of the go/misc/vim/in the corresponding syntax, ftplugin, indent, compiler Go.vim files copied to/usr/share/vim/ vim74/the corresponding directory, the Ftdetect folder includes files copied to Vim74.
Storm
Mail: [Email protected]
Beginner Go language-Install Go language