Dehiwala, Sri Lanka
21-05-2010
Colombo, Sri Lanka
21-05-2010
Colombo, Sri Lanka
16-06-2010
Dehiwala, Sri Lanka
21-05-2010
Go Language : Fueling Open Source

by Udaya Shamendra

 

Google Corporation’s GO Language is latest, highly comprehensive and effective system’s language.

GO is an open source project, distributed under a BSD-style license.

"GO combines the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++," according to a Google blog post.

GO which is expressive, concurrent, and garbage-collected language as their Home Page says.

Following Shows how the programming languages are ranking in 2009 and 2010.

 

Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

First of all I would like it if you also try GO’s power. Please use following instructions. (If you are familiar with any Programming Language, it will be more helpful you).

 

Installation & Basics

GO is not a Platform independent. I think that is the worst-case that affect GO to spread. It’s works on Linux and Mac Platforms. But even it’s not support to windows platform; it’ll conquer the programming language world as seen on above picture.

Remember all of GO Language most likely to C Language and it is very easy if you are familiar with C Language. And following instructions are for who works on linux platforms.

 

Installation:

i.Install by using apt-get via bison parser generator.

$ sudo apt-get install bison gcc libc6-dev ed gawk make

ii. To build the Go distribution and run

$ cd $GOROOT/src
$ ./all.bash

 

There are two ways to get experience with GO.

1. gc Go compiler and tools (6g, 8g etc.).

2. Uses gccgo, a more traditional compiler using the GCC back end.

Here you can see how to install and uses GO with first approach.

 

I’ll explain how to use GO in Linux platform and setting Environmental Variables

The Go compilation environment depends on three environment variables that you should set in your .bashrc or equivalent, plus one optional variable.

$GOROOT :

The root of Go tree. Typically this is $HOME/go but it can be any directory.

$GOOS and $GOARCH :

$GOOS $GOARCH
darwin amd64
freebsd 386
freebsd amd64
linux 386
linux amd64
linux arm

 

Above diagram shows what OS ($GOOS) going to use and the architecture ($GOARCH ) used. Choices of Architectures are 386 (x86 32bit), amd64 (x86 64bit or most mature port), arm (32bit Arm, an incomplete port).

 

$GOBIN (optional):

The location where binaries will be installed. As on Java it will be on default at C:\Program Files\Java\jdk1.6.0_03\bin . In GO language default is $HOME/bin. After installing, you will want to arrange to add this directory to your $PATH,

This is an example for above :

export GOROOT=$HOME/go
export GOARCH=amd64
export GOOS=linux

 

And After you setting those variables you can check if those are set properly or not, type following on terminal:

$ env | grep '^GO'

 

Write a Program

Simple Hello World Program:

package main
import fmt "fmt" // Package implementing formatted I/O.
func main() {
fmt.Printf("Hello, world;\n")
}

 

  • Save this text as helloworld.go
  • Compile it 6g compiler for Go Lang(amd64).
  • $ 6g file.go

    Output file which is compiled will be file.6 for amd64 architecture. It will be ‘8’ and ‘5’ for 386 and armare architectures.

  • To link that file use
  • $ 6l file.6
  • To run that use
  • $ ./6.out

Remember GO is just released and there will be some bugs and so many incomplete things.!

 

Gossips and Rumors about GO

The LOGO :

A Gopher :

A gopher is a small burrowing rodent that comes in many varieties. - Wkipedia

When looking at the above picture we can see those above logos are look like same. Yes it’s true. Both have same animal called gopher and designed by same person. PLAN 9 is a Bell Labs project and it is designed by Renee French.

PLAN 9 from Bell Labs is distributed operating system.

 

Is Google use GO Language ? :-D

GO is an experiment. Also it is just at experimental level. But Google use it for some cases and in future they will broadly use GO.

For example GO is used for server behind http://golang.org .

 

Object Oriented ?

Some parts of GO are object oriented and some parts are structured style.

 

Finally, hope you all will having Fun with GO !
This month’s Video
Promotional Video about Google’s GO language.

A short promotional video about the Go Programming Language presented by Russ Cox.

Your rating: None Average: 5 (4 votes)

Nice Article......

Nice Article......keep it writing.. We all are FOSS lovers!

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.