Skip to main content

Installing golang compiler in linux machine

Download the Go 1.12.1 binary archive suitable for your operating system from the official Go website (https://golang.org/dl/).

wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz

Extract the downloaded archive to the /usr/local directory:

sudo tar -C /usr/local -xzf go1.12.1.linux-amd64.tar.gz

Add the Go binary directory to your system’s PATH environment variable by editing your shell profile file (e.g. ~/.bashrc or ~/.zshrc) and adding the following lines:

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

Reload your shell profile to apply the changes:

source ~/.bashrc
go version

output:

go version go1.12.1 linux/amd64

lets print HelloWorld! from go
package main

import "fmt"

func main() {
	fmt.Printf("HelloWorld!")
}

Output:

HelloWorld!


<
Blog Archive
Archive of all previous blog posts
>
Blog Archive
Archive of all previous blog posts

Comments

Popular posts from this blog

Profiling CPU Usage in Go: Boosting Performance

Creating Custom Error Types in Go

Enhancing Database Security and Performance with Parameterized Queries