Build go environment under Mac

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

Original address: http://www.the5fire.com/setup-golang-env-on-mac.html

Installation is relatively easy, a brief introduction, after more experience in the dry.

1. Installation for all platform official website has installation instructions, here only for Mac system, download the latest version of the download page, download the direct installation can

2. Set the environment variable configuration goroot and gopath:

To create a home directory Go folder: mkdir ~/go The following things put to. BASH_RC (or maybe. bash_profile or. zshrc) export Goroot=/usr/share/goexport gopath= $HOME/ Goexport path= $PATH: $GOROOT/bin
    1. Try it.

To create a new Hello.go file:

Package Mainimport "FMT" Func Main () {    fmt. Printf ("Hello, world\n")}

Run: Go run hello

    1. Install additional Packages

Try go get xxxx on the line, such as I want to install MongoDB driver:

Go get Labix.org/v2/mgo

If you do not have BZR installed, you must first install BZR:

Brew install BZR  or download https://launchpad.net/bzr/2.5/2.5.1/+download/bzr-2.5.1.tar.gz to this, unzip the CD to the directory after completion. setup.py Install

Other packages are also available with the Get command, which can be installed directly from GitHub

    1. Configure VIM

Refer to this article: http://wenzhang.baidu.com/share/article/view?key=a534d1ed8359f3dd-1381909112&uk=1880012816

Okay, let ' s go!.


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.