Beginner Go language-Install Go language

Source: Internet
Author: User
Tags install go

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

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.