Hemanth's Scribes

web

Go on Ubuntu

Author Photo

Hemanth HM

Thumbnail

Go on Ubuntu

Go is a compiled, garbage-collected, concurrent programming language developed by Google Inc.

Below is a simple script to intsall it:

!/bin/bash

Save the pwd

cwd=pwd

Set the env

cat >> ~/.profile << EOT export GOROOT=$HOME/go export GOOS=linux export GOARCH=arch export GOBIN=$HOME/bin EOT

Set the Path

cat >> ~/.bashrc << EOT export PATH=${PATH}:$GOBIN EOT

Source them

source ~/.profile source ~/.bashrc

Build deps

sudo apt-get install python-setuptools python-dev build-essential mercurial bison gcc libc6-dev ed make

Check out the source

hg clone -r release https://go.googlecode.com/hg/ $GOROOT

Build the source

cd $GOROOT/src ; ./all.bash

Get back

cd $cwd Note: File attached with this post Testing $ cat >hello.go <<EOF package main import “fmt” func main() {

fmt.Printf("Hello, GO!\n")

} EOF $ 6g hello.go $ 6l hello.6 $ ./6.out With ggcgo $ gccgo hello.go $ a.out Note: 6g => amd64; 386 => 8 and arm => 5. Updating $ cd $GOROOT/src $ hg pull $ hg update release $ ./all.bash Keep GOing :)

#javascript#linux
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.