Go: How to setup

Download Go Archive

Go 1.14 (February 2020)

OSArchive name
Windowsgo1.14.windows-amd64.msi
Linuxgo1.14.linux-amd64.tar.gz
Macgo1.14.darwin-amd64-osx10.8.pkg
FreeBSDgo1.14.freebsd-amd64.tar.gz

Installation 

Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:

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

Add /usr/local/go/bin to the PATH environment variable.

OSOutput
Linuxexport PATH = $PATH:/usr/local/go/bin
Macexport PATH = $PATH:/usr/local/go/bin
FreeBSDexport PATH = $PATH:/usr/local/go/bin

On Windows:

Create a go file named test.go in C:\>Go_WorkSpace.

File: test.go

package main

import "fmt"

func main() {
   fmt.Println("Hello, World!")
}

Now run test.go to see the result −

C:\Go_WorkSpace>go run test.go

=> Output

Hello, World!

Leave a Reply

Your email address will not be published. Required fields are marked *