- Designed as a "systems" language
- Good all-rounder
- Syntax like C but simpler
- Garbage collection
- 25-ish keywords
- Compiled
- Strongly-typed
- Functions are first class citizens
- Capitalise routines that you want to expose
~/go/
src
pkg
bin
auto a = 10;
auto b = 10.0;
a := 10
b := 10.0
int main () {
}
package main
import {
"fmt"
"runtime"
}
func main() {
fmt.Println("Hello from ", runtime. GOOS);
}
go run hello.go
Go passes by value not reference.
var name string = "Ken"
Initialise at declaration
// Package level declaration
var {
first, second, age = "kenny", "key", 70.0
}
// Local declaration
func main() {
// Use := operator when declaring, = when assigning
a := 10
const b = 10.0
}