Golang and Vim-go installation configuration

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

I. Golang installation

1. Download the Golang installation package http://golangtc.com/download, which I downloaded here is go1.6rc2.linux-amd64.tar.gz.

2. Unzip to the installation directory, here I am /usr/local

1 sudo tar -zxf go1.6rc2.linux-amd64. tar. Gz-c/usr/local/

3. Add Environment Variables

1 sudo vim/etc/profile

Add to:

1 #golang环境 2 export golang_root_dir=/usr/local/go3 export path= $PATH: $GOLANG _root_dir/bin

Configuration takes effect:

1 source/etc/profile

4. Add Workspace gopath environment variables

1 Vim ~/.BASHRC

Add:export Gopath=/home/yuu/golang

Configuration takes effect:

1 source. BASHRC

At this point, use the GO command to verify that the build is successful:

yuu@yuukali:~$ go versiongo version go1.6rc2 Linux/Amd64yuu@yuukali:

Two. Installing Vim-go

1. Install the Vundle plugin manager first

1 git clone https://github.com/vundlevim/vundle.vim.git ~/.vim/bundle/vundle.vim

2. Refer to the official Https://github.com/VundleVim/Vundle.vim, configuration. VIMRC. In this default configuration, unwanted plugins can be commented out.

3. Add Vim-go in the Vundle configuration of the. VIMRC

1 ' fatih/vim-go '

after saving the exit, start vim again. Install vim-go with the command :P lugininstall . After waiting for the installation to complete, the done! is displayed and you can see a vim-go folder below ~/.vim/bundle.

4. Installing the relevant binary tools

Under Vim input : goinstallbinaries will automatically install the relevant tools, installed in the Gopath directory in the Bin folder .

The installation of the relevant files in ~/.vim/bundle/vim-go/plugin/go.vim, we can see the following several tools installed

1Let s:packages = [2\"Github.com/nsf/gocode",3\"Github.com/alecthomas/gometalinter", 4\"Golang.org/x/tools/cmd/goimports",5\"Github.com/rogpeppe/godef",6\"golang.org/x/tools/cmd/oracle",7\"Golang.org/x/tools/cmd/gorename",8\"Github.com/golang/lint/golint",9\"Github.com/kisielk/errcheck",Ten\"Github.com/jstemmer/gotags", One\"github.com/klauspost/asmfmt/cmd/asmfmt", A\ ]

Some of these URLs can not be accessed , if the installation fails, you may go to http://www.golangtc.com/download/package search download, download and put into the Gopath src directory, with Go Install installation ! after installation, the corresponding files will be generated in the pkg and bin directories in the Gopath directory! Vim-go default code complement is <C-x> + <C-o>.

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.