SlideShare a Scribd company logo
Let’s Go:
Introducing Google's New Programming Language		
Google's announcement of Go programming language during October 2009 has created lots of interest in
programming community. This article introduces Go to system programmers and cover some of the
novel/useful features of the language.
S G Ganesh, sgganesh@gmail.com
This is an article to introduce Go language. Readers will have lots of questions when they come
across a new (and promising) language, but because of limited space, I’ll cover only most important
aspects of Go in this article.
What is Go?
Go is a new, experimental, concurrent, garbage-collected, systems programming language.
new: It is a new language, and was publicly announced during the end of 2009.
experimental: It is still at experimental stage with tools, packages etc. still in development. There is no
production system implemented in Go as I write this article.
concurrent: It is a concurrent language which supports 'communication channels' which is based on
Hoare's Communicating Sequential Processes (CSP).
garbage-collected: The memory is automatically garbage collected, which relieves of the programmer
from manual bookkeeping of memory (as done in C/C++).
for systems-programming: It is intended for writing things like web servers. Still, we can use it as a
general purpose language.
Robert Griesemer, Ken Thompson (of Unix fame), and Rob Pike are the creators of the language.
All of Go’s toolset (compilers, packages, runtime libraries, tools etc) are made open source under
BSD license.
Goals and motivation
Let us first see what motivated Go’s creators for coming up with this new language. In last decade,
much has changed in computing world: Libraries have become bigger with
lots of dependencies which makes enterprise software development unbearably slow; internet and
networking has becoming pervasive; multi-core processors becoming mainstream and so on.
Systems programming languages (like C) were not designed with these in mind.
Concurrency features. The creators of the language found that there is a genuine need for a systems
programming language that is suitable for this new world. Go is suitable for use in multi-core and
networked world: Go is a concurrent language. It has ‘communication channels’ feature which is
much safer and different from threads and lock-based concurrency (like Java or Pthreads).
High-speed builds. It is faster to build applications with Go: The language is designed for fast
compilation in mind. Examples: the compiler does not need a symbol-table(!); the parser does not
need any look-ahead of tokens(!). Package dependencies are made explicit; dependent packages
require recompilation only if really needed: features like this enables quick builds. This approach is
unlike other languages like C, C++, Java etc.
Safe to use. Low-level languages like C are bug prone, particularly with manual memory management
and pointer manipulation. Go is garbage collected and is memory safe. It is a strictly typed language
and disallows unsafe programming (pointer manipulation is not allowed, for example), so it is also
type-safe.
Efficiency. Performance of Go code is within 10%-20% of the equivalent C code. Given the fact that
it supports features like reflection and garbage collection, the ability to execute write such efficient
programs is interesting (and impressive).
Ease of use. Go brings the ease of programming of a dynamically typed language, like Ruby and
Python. This is a surprising feature given the fact that it is a type-safe, statically typed language. The
code is also less verbose, with its features like type-inference (unlike Java, for example).
‘Hello world’ Example
It is a tradition to introduce a language by giving a ‘Hello world’ example, so here it is:
package main
func main() {
print("Hello world")
}
It prints ‘Hello world’ if you run it, as you would expect. Now, let us discuss about the program.
All the programs in Go should be in a package. In Go, the execution starts with ‘main.main()’
function. In other words, our ‘main’ function should be provided in ‘main’ package; that is what the
first statement does.
All functions are defined using ‘func’ keyword. The ‘main’ function takes no arguments and returns
nothing. We will not cover how to process command-line arguments in this article.
Go has a set of ‘built-in functions’ and ‘print’ is one of them. Alternatively, we could have used C-
like ‘Printf’ function from ‘fmt’ package (which provides formatted input/output functions).
Note that there are no semicolons in this program. This is a nice feature of Go: In most of the cases,
semicolons is optional. However, in few cases, we have to explicitly use semi-colons, and we’ll not
cover that issue in this article.
Novel features of Go
When I started learning Go, I found that it has many novel features. One of the best features is its
interface feature (not to be confused with ‘interface’ keyword in Java/C#). Any structure that
implements a set of methods given by an interface is considered to implement that interface! I saw
sample code in the Go source packages and was impressed by the simplicity and beauty of the
feature. Note that many dynamic languages support ‘duck typing’ which is more sophisticated and
flexible. However, Go achieves limited form of ‘duck typing’ with type-safety and flexibility, in a
statically typed language and that too meant for systems programming!
Go has an elegant declaration syntax different from most C-based languages. Go supports
‘goroutines’ (not same as ‘threads’ or ‘coroutines’ as in other languages), which is a powerful feature
for writing concurrent programs. We can use reflection in Go (remember it is a systems programming
language!). The support for packages and the way methods are imported/exported is simple and
straight-forward (no keywords like ‘public’, ‘export’ etc are needed, for example). There are more,
but I’ll leave it to you to discover them yourselves.
Installing Go
Currently, Go implementations are available for two platforms: Linux and Mac OS X. There are two
implementations for these platforms: One is a stand-alone implementation of Go compiler and
runtime, written by Ken Thompson. Another is a GCC front-end, implemented by Ian Lance
Taylor.
You can download and install Go by following the instructions given in Go’s official website:
http://golang.org/doc/install.html.
What about Windows? There is no official port of Go available for Windows and we can use
“unofficial ports” as of now (check unofficial Go site: http://go-lang.cat-v.org/os-ports).
I tried installing both Windows and Linux versions, and the installation was easy and smooth.
Wrapping up
With my experience in trying Go for last few months and writing non-trivial programs, I think there
is lots of substance behind hype: Go is certainly a language that has some unique features that will
make it as a useful systems programming language in this age of internet and multi-core processors.
So, it is not a surprised when I came to know that Go won Tiobe’s ‘language of the year award 2009’
(it won the award just after few months of its announcement!).
The best feature like liked in Go is its simplicity (yes, I am considering it a feature)! In just a couple of
days I have started learning Go, I was able to write non-trivial programs and started liking it. It was
fun learning and playing with the language. I would recommend Go to any systems programmer and
encourage trying it out.

More Related Content

What's hot (18)

PDF
Why you should care about Go (Golang)
Aaron Schlesinger
 
PDF
Computer programming tools and building process
ArghodeepPaul
 
PDF
Windows script host
ArghodeepPaul
 
PDF
The Ring programming language version 1.5.4 book - Part 5 of 185
Mahmoud Samir Fayed
 
PPTX
Ndu06 typesof language
nicky_walters
 
PPTX
Scaling applications with go
Vimlesh Sharma
 
PDF
Windows batch scripting
ArghodeepPaul
 
PDF
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
 
PDF
Building Command Line Tools with Golang
Takaaki Mizuno
 
PDF
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Codemotion
 
PDF
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Codemotion
 
PPTX
Programming languages
Simon Mui
 
PPTX
Go Language presentation
Gh-Mohammed Eldadah
 
PDF
The Ring programming language version 1.10 book - Part 99 of 212
Mahmoud Samir Fayed
 
PPTX
Evolution or stagnation programming languages
Daniele Esposti
 
PPTX
Theory of programming
tcc_joemarie
 
PDF
[INNOVATUBE] Tech Talk #3: Golang - Vũ Nguyễn
Nexus FrontierTech
 
PDF
An introduction to go programming language
Technology Parser
 
Why you should care about Go (Golang)
Aaron Schlesinger
 
Computer programming tools and building process
ArghodeepPaul
 
Windows script host
ArghodeepPaul
 
The Ring programming language version 1.5.4 book - Part 5 of 185
Mahmoud Samir Fayed
 
Ndu06 typesof language
nicky_walters
 
Scaling applications with go
Vimlesh Sharma
 
Windows batch scripting
ArghodeepPaul
 
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
 
Building Command Line Tools with Golang
Takaaki Mizuno
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Codemotion
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Codemotion
 
Programming languages
Simon Mui
 
Go Language presentation
Gh-Mohammed Eldadah
 
The Ring programming language version 1.10 book - Part 99 of 212
Mahmoud Samir Fayed
 
Evolution or stagnation programming languages
Daniele Esposti
 
Theory of programming
tcc_joemarie
 
[INNOVATUBE] Tech Talk #3: Golang - Vũ Nguyễn
Nexus FrontierTech
 
An introduction to go programming language
Technology Parser
 

Similar to Lets Go - An introduction to Google's Go Programming Language (20)

PPT
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
PPTX
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
PDF
Introduction to Go
Simon Hewitt
 
PDF
Introduction to Programming in Go
Amr Hassan
 
PDF
Introduction to go, and why it's awesome
Janet Kuo
 
PDF
An Introduction to Go
Imesh Gunaratne
 
PPTX
Golang (Go Programming Language)
ShubhamMishra485
 
PPT
Introduction to Go ProgrammingLanguage.ppt
PedroAlexandre215482
 
PPTX
Go programming language
GoWitek Consulting Pvt.Ltd
 
PDF
Go lang
Suelen Carvalho
 
PDF
Go Within Cloud Foundry
Platform CF
 
PDF
Golang : A Hype or the Future?
Mindfire LLC
 
PPTX
go language- haseeb.pptx
ArsalanMaqsood1
 
PDF
The Awesomeness of Go
Christina Rasimus
 
PPTX
Go fundamentals
Ron Barabash
 
PPTX
Ready, set, go! An introduction to the Go programming language
RTigger
 
PPTX
Lab1GoBasicswithgo_foundationofgolang.pptx
stasneemattia
 
PDF
The GO programming language
Marco Sabatini
 
PPT
Introduction to Go programming
Exotel
 
PDF
GoLang Introduction
Spandana Govindgari
 
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Introduction to Go
Simon Hewitt
 
Introduction to Programming in Go
Amr Hassan
 
Introduction to go, and why it's awesome
Janet Kuo
 
An Introduction to Go
Imesh Gunaratne
 
Golang (Go Programming Language)
ShubhamMishra485
 
Introduction to Go ProgrammingLanguage.ppt
PedroAlexandre215482
 
Go programming language
GoWitek Consulting Pvt.Ltd
 
Go Within Cloud Foundry
Platform CF
 
Golang : A Hype or the Future?
Mindfire LLC
 
go language- haseeb.pptx
ArsalanMaqsood1
 
The Awesomeness of Go
Christina Rasimus
 
Go fundamentals
Ron Barabash
 
Ready, set, go! An introduction to the Go programming language
RTigger
 
Lab1GoBasicswithgo_foundationofgolang.pptx
stasneemattia
 
The GO programming language
Marco Sabatini
 
Introduction to Go programming
Exotel
 
GoLang Introduction
Spandana Govindgari
 
Ad

More from Ganesh Samarthyam (20)

PDF
Wonders of the Sea
Ganesh Samarthyam
 
PDF
Animals - for kids
Ganesh Samarthyam
 
PDF
Applying Refactoring Tools in Practice
Ganesh Samarthyam
 
PDF
CFP - 1st Workshop on “AI Meets Blockchain”
Ganesh Samarthyam
 
PDF
Great Coding Skills Aren't Enough
Ganesh Samarthyam
 
PDF
College Project - Java Disassembler - Description
Ganesh Samarthyam
 
PDF
Coding Guidelines - Crafting Clean Code
Ganesh Samarthyam
 
PDF
Design Patterns - Compiler Case Study - Hands-on Examples
Ganesh Samarthyam
 
PDF
Bangalore Container Conference 2017 - Brief Presentation
Ganesh Samarthyam
 
PDF
Bangalore Container Conference 2017 - Poster
Ganesh Samarthyam
 
PDF
Software Design in Practice (with Java examples)
Ganesh Samarthyam
 
PDF
OO Design and Design Patterns in C++
Ganesh Samarthyam
 
PDF
Bangalore Container Conference 2017 - Sponsorship Deck
Ganesh Samarthyam
 
PDF
Let's Go: Introduction to Google's Go Programming Language
Ganesh Samarthyam
 
PDF
Java Generics - Quiz Questions
Ganesh Samarthyam
 
PDF
Java Generics - by Example
Ganesh Samarthyam
 
PDF
Software Architecture - Quiz Questions
Ganesh Samarthyam
 
PDF
Docker by Example - Quiz
Ganesh Samarthyam
 
PDF
Core Java: Best practices and bytecodes quiz
Ganesh Samarthyam
 
PDF
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
Wonders of the Sea
Ganesh Samarthyam
 
Animals - for kids
Ganesh Samarthyam
 
Applying Refactoring Tools in Practice
Ganesh Samarthyam
 
CFP - 1st Workshop on “AI Meets Blockchain”
Ganesh Samarthyam
 
Great Coding Skills Aren't Enough
Ganesh Samarthyam
 
College Project - Java Disassembler - Description
Ganesh Samarthyam
 
Coding Guidelines - Crafting Clean Code
Ganesh Samarthyam
 
Design Patterns - Compiler Case Study - Hands-on Examples
Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Brief Presentation
Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Poster
Ganesh Samarthyam
 
Software Design in Practice (with Java examples)
Ganesh Samarthyam
 
OO Design and Design Patterns in C++
Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Sponsorship Deck
Ganesh Samarthyam
 
Let's Go: Introduction to Google's Go Programming Language
Ganesh Samarthyam
 
Java Generics - Quiz Questions
Ganesh Samarthyam
 
Java Generics - by Example
Ganesh Samarthyam
 
Software Architecture - Quiz Questions
Ganesh Samarthyam
 
Docker by Example - Quiz
Ganesh Samarthyam
 
Core Java: Best practices and bytecodes quiz
Ganesh Samarthyam
 
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
Ad

Recently uploaded (20)

PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Import Data Form Excel to Tally Services
Tally xperts
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 

Lets Go - An introduction to Google's Go Programming Language

  • 1. Let’s Go: Introducing Google's New Programming Language Google's announcement of Go programming language during October 2009 has created lots of interest in programming community. This article introduces Go to system programmers and cover some of the novel/useful features of the language. S G Ganesh, [email protected] This is an article to introduce Go language. Readers will have lots of questions when they come across a new (and promising) language, but because of limited space, I’ll cover only most important aspects of Go in this article. What is Go? Go is a new, experimental, concurrent, garbage-collected, systems programming language. new: It is a new language, and was publicly announced during the end of 2009. experimental: It is still at experimental stage with tools, packages etc. still in development. There is no production system implemented in Go as I write this article. concurrent: It is a concurrent language which supports 'communication channels' which is based on Hoare's Communicating Sequential Processes (CSP). garbage-collected: The memory is automatically garbage collected, which relieves of the programmer from manual bookkeeping of memory (as done in C/C++). for systems-programming: It is intended for writing things like web servers. Still, we can use it as a general purpose language. Robert Griesemer, Ken Thompson (of Unix fame), and Rob Pike are the creators of the language. All of Go’s toolset (compilers, packages, runtime libraries, tools etc) are made open source under BSD license. Goals and motivation Let us first see what motivated Go’s creators for coming up with this new language. In last decade, much has changed in computing world: Libraries have become bigger with lots of dependencies which makes enterprise software development unbearably slow; internet and networking has becoming pervasive; multi-core processors becoming mainstream and so on. Systems programming languages (like C) were not designed with these in mind. Concurrency features. The creators of the language found that there is a genuine need for a systems programming language that is suitable for this new world. Go is suitable for use in multi-core and networked world: Go is a concurrent language. It has ‘communication channels’ feature which is much safer and different from threads and lock-based concurrency (like Java or Pthreads). High-speed builds. It is faster to build applications with Go: The language is designed for fast compilation in mind. Examples: the compiler does not need a symbol-table(!); the parser does not
  • 2. need any look-ahead of tokens(!). Package dependencies are made explicit; dependent packages require recompilation only if really needed: features like this enables quick builds. This approach is unlike other languages like C, C++, Java etc. Safe to use. Low-level languages like C are bug prone, particularly with manual memory management and pointer manipulation. Go is garbage collected and is memory safe. It is a strictly typed language and disallows unsafe programming (pointer manipulation is not allowed, for example), so it is also type-safe. Efficiency. Performance of Go code is within 10%-20% of the equivalent C code. Given the fact that it supports features like reflection and garbage collection, the ability to execute write such efficient programs is interesting (and impressive). Ease of use. Go brings the ease of programming of a dynamically typed language, like Ruby and Python. This is a surprising feature given the fact that it is a type-safe, statically typed language. The code is also less verbose, with its features like type-inference (unlike Java, for example). ‘Hello world’ Example It is a tradition to introduce a language by giving a ‘Hello world’ example, so here it is: package main func main() { print("Hello world") } It prints ‘Hello world’ if you run it, as you would expect. Now, let us discuss about the program. All the programs in Go should be in a package. In Go, the execution starts with ‘main.main()’ function. In other words, our ‘main’ function should be provided in ‘main’ package; that is what the first statement does. All functions are defined using ‘func’ keyword. The ‘main’ function takes no arguments and returns nothing. We will not cover how to process command-line arguments in this article. Go has a set of ‘built-in functions’ and ‘print’ is one of them. Alternatively, we could have used C- like ‘Printf’ function from ‘fmt’ package (which provides formatted input/output functions). Note that there are no semicolons in this program. This is a nice feature of Go: In most of the cases, semicolons is optional. However, in few cases, we have to explicitly use semi-colons, and we’ll not cover that issue in this article. Novel features of Go When I started learning Go, I found that it has many novel features. One of the best features is its interface feature (not to be confused with ‘interface’ keyword in Java/C#). Any structure that implements a set of methods given by an interface is considered to implement that interface! I saw
  • 3. sample code in the Go source packages and was impressed by the simplicity and beauty of the feature. Note that many dynamic languages support ‘duck typing’ which is more sophisticated and flexible. However, Go achieves limited form of ‘duck typing’ with type-safety and flexibility, in a statically typed language and that too meant for systems programming! Go has an elegant declaration syntax different from most C-based languages. Go supports ‘goroutines’ (not same as ‘threads’ or ‘coroutines’ as in other languages), which is a powerful feature for writing concurrent programs. We can use reflection in Go (remember it is a systems programming language!). The support for packages and the way methods are imported/exported is simple and straight-forward (no keywords like ‘public’, ‘export’ etc are needed, for example). There are more, but I’ll leave it to you to discover them yourselves. Installing Go Currently, Go implementations are available for two platforms: Linux and Mac OS X. There are two implementations for these platforms: One is a stand-alone implementation of Go compiler and runtime, written by Ken Thompson. Another is a GCC front-end, implemented by Ian Lance Taylor. You can download and install Go by following the instructions given in Go’s official website: http://golang.org/doc/install.html. What about Windows? There is no official port of Go available for Windows and we can use “unofficial ports” as of now (check unofficial Go site: http://go-lang.cat-v.org/os-ports). I tried installing both Windows and Linux versions, and the installation was easy and smooth. Wrapping up With my experience in trying Go for last few months and writing non-trivial programs, I think there is lots of substance behind hype: Go is certainly a language that has some unique features that will make it as a useful systems programming language in this age of internet and multi-core processors. So, it is not a surprised when I came to know that Go won Tiobe’s ‘language of the year award 2009’ (it won the award just after few months of its announcement!). The best feature like liked in Go is its simplicity (yes, I am considering it a feature)! In just a couple of days I have started learning Go, I was able to write non-trivial programs and started liking it. It was fun learning and playing with the language. I would recommend Go to any systems programmer and encourage trying it out.