“Whaaat!? Haaa, ok”

One key thing you should understand is that Go is very opinionated. For example regarding syntax, in Go you MUST put the { in your if statement at the same line. Not doing so will result in a compilation error!

No OOP

Go is structured in a way that classes, inheritance, and polymorphism are not possible (or at least very difficult). What started as “I don’t like that!” became “Hmmm, maybe that’s even better!” when I understood that Go is pushing you to use composition instead of inheritance.

Shortcuts

In Go, there are many shortcuts. It almost feels as though anything that can be written in Go with fewer characters.

// The long way

var age Int = 42 // The short way

age := 42

This makes your learning curve steeper, but if you stick with Go, you’ll (probably) eventually like it.

Map/Reduce

Go is typed, but no generics. This means that you don’t have the lodash-like map/reduce functions. This “Whaaat” did not end with “haa ok”…

It is planned for future versions of Go.

Packages

When I first installed Go and wanted to create a project, I thought that I’d create a folder and put all my code there, build it, and run…nope. This is not how Go usually operates. All your projects should be under the same global src folder, under a folder unique to your project, usually your Github path (for example: ~/go/src/github.com/gilamran/PBFT-Typescript )

There are many issues with this approach like the dependencies of your project being under the same src folder and versions becoming a big issue.

Golang does support vendor folder (Similar to node_modules in JavaScript), but it will fetch the master branch…

There are many attempts to solve this, but know that currently dependencies in Go can be painful.

Tests

Golang loves tests, so much so that when the compiler detects test files (by file name _test.go), it will automatically exclude the test code when you build.