Go

From Leo's Notes
Revision as of 03:38, 10 August 2017 by Leo (talk | contribs)
This page was last edited on 10 August 2017, at 03:38.

Introduction

Installation

The simplest way to get the latest version of go is to download it from https://golang.org/dl/. Extract the package to /usr/local/go and then set the following environment variables:

$ export PATH=$PATH:/usr/local/go/bin
$ export GOPATH=$HOME/go

Fetching Packages

You can get go packages using the go get command. This will download it to your $GOPATH/src directory. In order to use the package, you will also need to build it by using the go build command.

Eg:

$ go get github.com/miekg/dns
$ go build github.com/miekg/dns

Simple Program

Create your program in $GOPATH/src/, ideally under a unique namespace. To build, run go build followed by your namespace and program name. If it compiles properly, the program will be placed in the current working directory.


Resources

Play with golang online.

Guides

Quick Overview

TBD