I tried Go and I liked it

Say hello to Gopher.
Gopher is the mascotte of a new language from Google, called Go, with the capital G.
Not a very clever name from a search engine company, if you ask me, but that’s probably the only bad thing you will hear about it.
Hint: use the word golang to search on Google
A brief introduction
Created inside Google by Ken Thompson and Rob Pike, fathers of Unix and UTF-8, to overcome the limitations of C++ (compile times being the most annoying), Go is a concurrent, garbage-collected language with fast compilation.
Its real strength is just simplicity.
As Rob Pike once said, less is exponentially more and I strongly agree with him.
Features
- blazing fast compilation speed
- statically compiled binaries (the result is a single binary with no external dependencies)
- type safe, statically typed with some type inference support. More errors get caught at compile time, less time is spent debugging
- garbage collected with support for pointers, but no pointer arithmetics (for safety and good health of programmers minds).
- strict compiler: you can’t declare a variable or import a package without using it
- concurrency and parallelism through goroutines. Goroutines are one of the peculiarities of Go, they are a cheap, lightweight construct built on top of threads, that run concurrently with other goroutines. If you have more than one core processor, they also run in parallel, in a completely transparent way for the programmer. Communication is managed sending messages through channels which are basically type safe queues.
- Object orientation but no classes. Any type can be an object.
- No type inheritance in favour of composition and duck typing. IS-A relationships are banned!
- multiple return values
- rich standard library.
- a powerful set of command line tools including one to enforce coding conventions and one for automatic code documentation.
Many IDE that support Go, launch gofmt just before save, to ensure that every Go file obey the rules.
- last, but not least, cross compiling. Go compiler can create binaries for platforms/architectures different from the one it is running, provided the platform is supported.
Continue reading “I tried Go and I liked it” →