..

Go Notes

  • Go code organization
    • Go code is organized into packages
    • Each package is a directory that contains .go files. Go package are analogous to libraries in C.
    • The main package is not a library but rather it is the file where the main() function is defined.
    • This serves as the starting point for the program
  • Command line args
    • Command line arguements are accessed through the os.Args variable.
    • It is a slice of strings.
  • Random quirks of Go
    • Variables have a zero value. Unlike C where an uninitialized variable contains garbage value, Go variables have a default value

Hello, World! in Go

package main
import "fmt"
func main() {
    fmt.Println("Hello, World")
}