Initializing variables in Go

Normal initialization

var myStr string = "mystring"
var myInt int = 10

If you don't explicitly initialize a variable with a value, it will get the zero value for it's type.

var myStr string // myvar == ""
var myInt string // myvar == 0

Short initialization

Short initialization is performed using the := operator. It can only be done within a function, and the type of the variable is inferred from the value assigned to it.

myStr := "mystring"
myInt := 10