In October 2011 I have already blogged about the Go programming language. I haven't used it until recently when I needed a small system and web server program. I remembered Go as a prefect fit for this task. Others have come to the same conclusion. See here and here. Since my last post a lot has changed that is well worth a new post.
Changes:- The go build tool was introduced. Easing running and building
of Go code
- There was a 1.0 release of the language
- gccgo (Go compiler based on gcc) became first class compiler for the language
- Both are in the Ubuntu repository of 12.10
- There is now a database package
- Subjective more external projects on github done with Go and for Go
- Subjective more blog posts about it
- HTML 5 apps have risen. Not a change in Go but with a huge
impact on it.
Still the same (annoying):
- Each import must be used or you get a compiler error
- Each variable must be used or you get a compiler error
- Still no packages for desktop development
- gc (The compiler from the language creators) still produces just static binaries.
- (No Generics and no complex Annotations)
I haven't used the latest version from golang.org (1.0.3) but the
one in the Ubuntu repository (1.0.2). This shouldn't be a problem
as it is only a minor
change.
Some remarks that aren't worth an own post:
The go tool is great. You don't have to select a compiler anymore
to build a Go program. Just call go build and it will
select the correct compiler. It even gets better. With go run
you don't have to compile your code not at all to execute it. E.g.
go run hello.go will execute the code in hello.go. This
improves the scripting like of Go a lot. Well when you have
learned to handle the strictness of the compiler. You will get
stopped very often because there is either an unused import after
you have removed a debug print statement or there is an unused
variable when you want to do a quick test if your current code
performs correct until now. For the first case add a print
statement at the start of main and delete it just before you go to
production. For the second issue just don't assign the variable or
use the underscore.
The rise of HTML 5 apps wasn't a change in Go but it is a kind of
game change in the usage field. With HTML 5 apps you have a set of
static files (html, javascript,css ...) that uses ajax to get json
encoded data via a restful API. This annuls the difference between
the page centric attribute of Go and the component centric
attribute of JSF to generate a HTML frontend. Besides getting it
closer to Java the rise of HTML 5 apps has dropped the demand for
desktop applications. So it became a less burden that Go has no
support for them. Oh wile talking about lacking features. Thanks
to the rise of json based restful APIs the lacking of xml based
webservices isn't as hurting as it was too. You see, although Go
hasn't changed it became more useful because the world has change
into an area where go already excelled.
I have put the point about Generics and Annotations in
parenthesis as I've got less sure if I really need them. I had
finished my small web app without the use of them. On the other I
hadn't used a database. Databases or to be more precise ORMs are
the area where I suppose that I will miss Annotations. It seems
that I have to write more complex programs to evaluate that point.