lost and found ( for me ? )

Showing posts with label GO lang. Show all posts
Showing posts with label GO lang. Show all posts

Install go language by using gvm

about gvm.
https://github.com/moovweb/gvm

You can install specific Go version and switch go version from one to another with gvm.

install required packages to build gvm
# tail -1 /etc/lsb-release ;uname –ri
DISTRIB_DESCRIPTION="Ubuntu 13.10"
3.11.0-19-generic x86_64

# apt-get install curl git mercurial make binutils bison gcc build-essential

install gvm

# source /root/.gvm/scripts/gvm

# which gvm
/root/.gvm/bin/gvm

install go 1.2
# gvm install go1.2
Downloading Go source...
Installing go1.2...
* Compiling...

# gvm list

gvm gos (installed)

  go1.2

# gvm use go1.2 --default
Now using version go1.2

# go version
go version go1.2 linux/amd64

# which go
/root/.gvm/gos/go1.2/bin/go

# cat hello_world.go
package main

import "fmt"

func main() {
   fmt.Println("hello world")
}

# go run hello_world.go
hello world

# go build hello_world.go

# ./hello_world
hello world

Fedora 20 : install Go 1.2 lang

Reference

# cat /etc/fedora-release ;uname -ri
Fedora release 20 (Heisenbug)
3.13.0-1.vanilla.mainline.knurd.1.fc20.x86_64 x86_64

untar file and store these file under /usr/local/go directory
# tar -C /usr/local -xzf go1.2.linux-amd64.tar.gz

# ls /usr/local/go
AUTHORS       LICENSE  README   api  blog  favicon.ico  lib   pkg         src
CONTRIBUTORS  PATENTS  VERSION  bin  doc   include      misc  robots.txt  test



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

# which go
/usr/local/go/bin/go

# go version
go version go1.2 linux/amd64

make a go file
# cat hello.go
package main

import "fmt"

func main() {
   fmt.Print("hello\n")
}

run
# go run hello.go
hello