Julio's Blog

Installing Go (GoLang) on CentOS 7.

In this post, I will show how to install the Go programming language (GoLang) on CentOS 7. This procedure is quite simple and requires only a few commands.

Install the packages:

[[email protected] ~]# yum install golang golang-godoc golang-vet golang-src golang-pkg-linux-amd64 -y

After this we check that the go command could be call and is working:

[[email protected] ~]# go version
go version go1.4.2 linux/amd64  

Hello world! on Go:

Now we will try to compile and verified Go, to do this we will create a file, name it hello.go and put a sample "hello world" program on it. To do this:

[[email protected] ~]# cat << EOF > hello.go
package main

import "fmt"  
func main() {  
fmt.Printf("hello world!\n")  

Now we proceed to run the program created before:

[[email protected] ~]# go run hello.go
hello world!  

Now just enjoy Go!

Julio is a Principal Cloud Architect at Red Hat working on Linux, Virtualization, Cloud (OpenStack), and Containers.Julio was born in Cuba but now calls home Austin, TX.