At my new job we have a Go backend. It’s a nice language with familiar syntax. Someone with C, C++, C# or Java experience will feel right at home. A language designed to make Software Engineering easier. At the same time it’s being sought out to address bottlenecks in Ruby, Perl, Node.js and Python codebases.
We chose Go because it seemed like a useful tool to understand for building large software systems. The Scripting languages are among the slowest, Go is compiled into a binary so no runtime is spent interpreting. A binary also makes the deployment process painless as you can just scp the file around. Go is a modern language with first-class concurrency primitives. It’s been designed to leverage modern hardware with multiple cores.
Go is a language designed in the service of software engineering. Other programming languages come from academia Haskell, OCAML, ML, etc.
Go on the otherhand was designed to solve problems faced at Google. One such problem is software management. Meaning, how do we deal with
codebases which are millions of lines long? How do we deal with version skew over time? Go is designed to be a very concise language. It’s
spec is among the smallest of any language. Such conciseness allows for the creation of code reading tools. Tools like gofmt
, gofix
and
godoc
. The language also lacks class-inheritance favoring the gang-of-four’s
Composition over Inheritance pattern.
Source: Program your next server in Go
#go-nuts
chat channel. They get pretty pedantic at times and frequently refer you to the Spec.The Go team has developed a very good blog. All the articles are very good and
essential actually for many useful go tools like go test
and go doc
. Useful for staying up to date on language news.
_foo
super usefulUse Godoc to document your programs, it’s very good and everyone uses it. We use it at Capsule to generate our internal API documentation.
godoc -http=:6060 -goroot=.
assuming you’re in a project’s directory.
godoc docs are designed to give you a snapshot of all go code on your machine. Once you have this running you can see the docs by navigating to http://localhost:6060/
The way Object-Orientation is achieved in Go differs a bit from languages like Java or C#. The main facility is via interfaces. This approach helps avoid long class hierarchies.
Here are some code samples I’ve written over the past couple of months. Every time I learned something or made a new insight into Go as a noob I ended up making a playground demo and tweeting it. Hopefully some of them are useful to someone else.
printf("%T", var)
prints the type of a variableflag
stdlib package to give your software argumentsSome literature from one of the author’s of Go, Rob Pike, on Go’s design.
If you need help solving your business problems with software read how to hire me.