One of Go programming basics go development environment building

Source: Internet
Author: User

Learning Path: The basics of Go programming without a sniff

Mac installation Golang

Two installation methods are introduced, and can also be installed by brew.

PKG Installation

Download Address
The next step is to install

Tar Package Decompression Installation

Download Address

-C /usr/local-xzf go$VERSION.$OS-$ARCH.tar.gz

Unzip to install

Brew Installation

Tutorial

install go

Path settings

Take the brew installation go as an example.

export PATH=$PATH:/usr/local/opt/go/libexec/binexport GOROOT=/usr/local/opt/go/libexecexport GOPATH=$HOME/.goexport PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Before joining. Zshrc,source ~/.ZSHRC Make it effective
Note: Export path= $PATH:/usr/local/opt/go/libexec/bin Not set is also possible, because there are links in/usr/local/bin.

Test

New file

vim hello.go

Input code

package mainimport"fmt"func main(){    fmt.Printf("Hello, go!")}

Test run

go run hello.go

Output results

Hellogo!%
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.