In this post I will demonstrate how to setup a golang environment on Ubuntu.
Get the sources:
Get the latest stable release golang tarball from https://golang.org/dl/ and download to the directory path of choice, and extract the archive:
1 2 3 |
|
Once the archive is extracted, set root permissions and move it to the path where your other executable binaries reside:
1 2 |
|
Cleanup the downloaded archive:
1
|
|
Path Variables:
Adjust your path variables in your ~/.profile
and append the following:
1 2 |
|
Source your profile, or open a new tab:
1
|
|
Test if you can return the version:
1 2 |
|
Create a Golang Application
Create a simple golang app that prints a string to stdout:
1 2 3 4 |
|
Add the following golang code:
1 2 3 4 5 6 7 |
|
Build the binary:
1
|
|
Run it:
1 2 |
|