Ubuntu Go Language Environment

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

http://blog.csdn.net/liuhongwei123888/article/details/8512815

Ubuntu Install go:
sudo add-apt-repository ppa:gophers/go
sudo apt-get update
sudo apt-get install golang-stable

Or

sudo apt-get install Golang

or download the Go language installation package directly

Environment configuration:
Vi/etc/profile
Join
Export Goroot=/usr/lib/go
Export goarch=386
Export Goos=linux
Export Gopath=/home/administrator/workspace/go
Export gobin= $GOPATH/bin
Export path= $GOPATH/bin: $PATH

Source/etc/profile

Create a new three directory under new Gopath
mkdir src Pkg Bin
SRC Storage Source
Pkg to store compiled generated files
Bin holds the resulting executable file

Create your first Go app
CD $GOPATH/SRC
mkdir test1
CD Test1
VI T1.go

[CPP]View Plaincopy
  1. Package Main
  2. Import "FMT"
  3. func main ()  {  
  4.     fmt. Println ( )   
  5. }

Main.main () is the entrance to the Go app

Compilation method
1, enter the corresponding application package directory, and then perform go install, you can install the
2. Execute the following code in any directory go install test
3, enter the corresponding application package directory, and then execute go build, will generate the executable file in the current directory

Configure VIM to support go language syntax highlighting
Cp-r $GOROOT/misc/vim/* ~/.vim/Note: $GOROOT is the Go installation directory
VI ~/.VIMRC Join
FileType plugin indent on
Syntax on

Installing Gocode

Go get-u github.com/nsf/gocode
The Gocode is installed by default under $gobin.

Configure Gocode

~ CD $GOPATH/src/github.com/nsf/gocode/vim
~./update.bash
~ Gocode Set Propose-builtins True
Propose-builtins true


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.