GopherCon India happened from 19th to 21st February 2015 in Bangalore and it was an amazing experience for me. It started with workshop on first day followed by 2 days of main conference presented by speakers coming from different corners of globe. Slides from the conference are available on github and pictures on flickr

Go Workshop

I am totally new to coding in Go, so I thought it will be a good idea to attend the workshop. I hoped that it will help me in understanding the conference talks better. The topics covered by William Kennedy during the workshop were very good. He covered all the basic and important topics like variables, pointers, functions, types, slices, methods, interface, goroutines, channels, etc very well with hands-on examples. Goroutines are very interesting topic as all of them can run concurrently and leads to no block in your application. It took me some time to digest variable declaration in Go.

For example, for declaring an int variable in C/C++ or Python we do “int foo” while in Go we write “foo int”.

Same applies to function definitions. Function declaration in C, C++ looks like-

return_type function1(int *var1)

while in Go we write,

func function1(var1 *int) (return_type1, return_type2, …)

But from whole conference, I observed lot of speakers saying that while learning any new language you should forget whatever you learnt before and learn as if you are learning a new language. I personally liked this idea and I would suggest everyone should follow this while learning new concepts.

Conference

Day 1

After usual registration work, everyone went to conference room to attend talks and keynotes. It was quite surprising to see cute little gophers sitting on chairs for everyone 😀

Conference started with Opening Keynote by Francesc Campoy Flores where he nicely explained various types of people who uses Go. He categorized Go users as

Newcomers – who are very new to Go and want to learn

Explorers – who are familiar with basic coding in Go and are now trying to make useful applications using Go to understand it more

Builders – who know Go very well and have developed Go applications

Experts – who understand specs and knows all details of Go

It was interesting to know about these tools:

gofmt – Formats your code according to Go standard (yay, you don’t have to worry about formatting anymore)

goimport – Adds missing import packages in your code and also removes unnecessary imports.

goreturns – The best one as it will run both gofmt and goimport for you, in addition to that it will auto add return variables in case your functions don’t have any.

Talks from Aaron Cruz and Gabriel Aszalos provided multiple tips on how one should be working on a Go project and how code should be written. Couple of tips were:

Use good editor of your choice which has support for Go like sublime, vim, etc to write code faster.

While contributing to new project, first go through README and documentation in order to understand overview.

To understand a new codebase, it is really important to follow the flow in which code is written and best way is to first look for entry point in project.

Every now and then you should look into components of project which you haven’t looked into from long time and refactor them in case needed.

Use gofmt, goimport and goreturn tools to keep code clean, formatted and less error prone

In order to get source code from Github, we can use “go get <source name>” instead of git clone.

Code should be well documented, tested for keeping code maintainable for long run. At least exported functions from libraries must be documented so that user can use them without hassle.

Code written in Go should be readable – not in english language but in terms of Go. For example if you are creating an empty struct in Go, no need to to create a new empty struct like type struct empty {} instead of it whenever you need an empty struct just write struct {} there

Try to use features available in Go libraries instead of writing your own. For that one should explore Go functionalities and should go through its specs.

Regardless of what language you are coding, I would say these tips are useful for everyone.



The next talk was about Mike Gehard’s journey from being a Rubyist to a Gopher. One of the things he suggested was to read the Go language specification to understand why certain design decisions were made. For the builder, he suggested to understand Go’s common idioms as it helps in producing effective code. The major difference he discovered between Go and Ruby was OO support. He suggested to use small structs and methods that operate on them instead of classes/objects. Learning to program to the interface is something he emphasized as well. For understanding concurrency, he asked people to watch the Concurrency Patterns talk by Rob Pike. For experimenting, he suggests using http://play.golang.org/ . Finally, he said that the golden rule is to forget old idioms from Ruby and not fight Go.

Julia Poladsky shared her experience on how she is using Go now in her work with Java Script. Being a web front-end developer, she compared very well how Go is a better designed language than JS. She feels Go as one of language which is going to be used in future as well by developers due to features like providing async behaviour, concurrent, Garbage collection, enforcing error handling in code which makes code more robust and I too agree with her.

A Physicist at day and Android app developer at night, Verónica explained how easy it was for her to code in Go being a Physicist. While she was excited by the possibility of writing Android apps in Go, she mentioned that the current support is crude and very painful to setup with the Android SDK.

While I haven’t written Go packages myself, this talk about principles of designing packages gave a good insight in Go practices. Alan Shreve explained that usually Go packages should do everything synchronously and let the called handle the async. However, he also showed situations where the opposite was desirable.

Rajesh Ramachandran shared his experience with using Go at Qube cinemas where they do high performance digital media. Due to performance requirements, the actual processing happens in C and Go is used to do post processing with the results. He explained with code how to call Go methods from C and the other way round. He listed the caveats that one should be aware of when using Cgo to do this.

First day ended with closing keynote by Baishampayan Ghose. He told in a very beautiful way that Go is not a 6 year old programming language but it is more than 40 years old. He explained how Go used different useful concepts from various old programming languages like BCPL, Modula2, Newsqueak, SmallTalk, Pascal, C, etc and evolved as a powerful modern programming language.

It was interesting to see that lot of people have migrated from Ruby/Python to Go and are very happy with it. It was funny to hear everyone saying evil Java during conference. I was very happy with talks covered on first day and surprised to see Go solving multiple real world problems in fast way. I was eager to attend talks which were lined up for the next day.

Day 2

As Go is a high performance language which comes very close to C, it was not surprising to see people using it for embedded programming. Kunal powar from SoStronk presented the EMBD package which lets people write embedded code which interacts with sensors and various communication protocols. The cool thing about EMBD was that it can work on a variety of boards like Raspberry Pi, BeagleBone etc. Kunal showed a demo of an accelerometer controlling an airplane model in a desktop application.

Martin Schoch talked about bleve which is a text indexing and search library for Go where you can index text based documents and later query for terms. You can have exact matches by keyword or a complete phrase. Martin demoed bleve by querying the Gophercon India talk schedule he had indexed earlier. He also showed that there is Unicode support by searching for the Hindi terms in Wikipedia pages he had indexed.

EDIT : In demo, taking Hindi Analyzer as example Martin showed Indic and Hindi character normalization, Hindi stemming, and Hindi stop word removal. Analyzers are what improve search recall when you customize the mapping to indicate data is in a particular language.

The next talk by Jyotiska NK was particularly interesting because I personally found Image Processing quite difficult in my college days. Jyotiska explained that their system extracts dominant colors from images in e-commerce websites such as Amazon. The earlier system was implemented in Python but was very CPU intensive and memory consumption was high. They later implemented the same in Go and got reduced CPU usage, reduced memory and could serve more requests thanks to Go’s easy concurrency. The only pain point was interfacing with C code for OpenCV which was complex even with tools like SWIG. The other limitation was that there weren’t that many libraries in Go which supported scientific computing like SciPy and NumPy in Python.

Dave Cheney ended the conference with his closing keynote in which he talked about why Go is simple by design. He explained that to the Go creators it was more important to be simple than to being complete.

There was also a FAQ session where panel members and speakers gave answers to questions asked by conference attendees as well as asked online –

One of question was first Go experience of panelist members and kinds of problem they faced. Answers were quite mixed like for Julia, in Denver there is already active Go community while for Verónica in Mexico people are very repellent for learning new language.

Support for embedded system like Raspberry Pi – currently embd is there with few functionality. In future support for embedded devices will be added.

Can Go be recommend as first programming language to learn like C, C++, Python? The panel agreed it can be.

I must say that GopherCon 2015 was awesome with variety of talks on Go. For beginners in Go like me, this conference was the right place. Thanks to my employer Red Hat for sponsoring my workshop and conference ticket. Organizers had done very good job in arranging everything including venue, speakers, food, quality of talks and keeping conference on time. Being a C/C++ programmer, I must say that I am impressed by Go. Looking forward to learn it in more detail and also start with writing few applications using Go to get feel of its power. I would recommend others as well to give it a try.