Social Icons

Showing posts with label go language. Show all posts
Showing posts with label go language. Show all posts

Sunday, March 01, 2020

Install "golang-github-gorilla-mux-dev" package :Ubuntu 18.04 LTS

Single line command at terminal

sudo apt-get install -y golang-github-gorilla-mux-dev

 

Install "golang-github-joho-godotenv-dev" package: Ubuntu 18.04 LTS

Single line command

sudo apt-get install -y golang-github-joho-godotenv-dev


Installing GO in Ubuntu 18.04 LTS

M sharing here only the terminal commands for installing GO in Ubuntu 18.04...followed by checking whether it is working or not....

Commands as follows in yellow :


Download the recent tar...herein it is go1.14.linux-amd64.tar.gz

Further to this untar the same...and move the files to /usr/bin

sudo tar -xvf go1.14.linux-amd64.tar.gz
sudo mv go /usr/local
cd /usr/local/
sudo chown -R root:root ./go

Using gedit or any other vi/vim editor, open the ~/.profile file and append the following lines at the bottom :

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

Save and load the commands vide the following command

source ~/.profile

Now create a new directory

mkdir GOLA

Within this create /src/welcome and within that directory copy and paste the contents of the file below

mkdir -p GOLA/src/welcome && cd GOLA/src/welcome
touch welcome.go
gedit welcome.go 

add the following lines here in this file

package main
import "fmt"
func main() {
    fmt.Printf("welcome to go world\n")
}
 

and save above followed by build and running the file

go build

./welcome
message should be displayed welcome to the go world

Powered By Blogger