Goroutines and channels

One of Go’s initial design requirements was to make it easy to create multi-threaded applications. While many languages support multi-threading, it’s not always easy to implement. Go wanted to make it easy to do this. Consider the following code where it runs sequentially. If you run this, every function call to PrintHello() has to complete…

Working with Maps in Go

Working with a Map in Go is like Dictionaries in Python, or Maps in Java. A Map stores information as key/value pairs. This is a nice thing about data structures, they are often found in other languages. Defining the Map When you define one in Go, you need to define the variable as a type…

Math in Go

Performing Math in Go is like many other programing languages in many ways. Of course, the standard mathematical symbols apply: Operator Description + Addition – Subtraction * Multiplication / Quotient % Remainder & Bitwise AND | Bitwise OR ^ Bitwise XOR &^ Bit clear (AND NOT) << Left shift >> Right shift (logical) The Math…