The Go Programming Lang

GOPATH Run, build and install Dependencies Formatting Documentation Structuring a source tree The lang Variables Control structures (if, switch and for) if switch for I/O fmt CLI Args Flags Basic Data Types Type conversion Strings Unicode String literals Numbers Integers Bitwise operations Floating point Constants Pointers Functions Grouped parameters types Variadic functions Multiple return values Named return values Recursion Deferred functional calls Functions as values Function literals (anonymous functions) Passing functions to functions Closures Error Handling Error handling strategies Propagate to caller Retry Log and continue Log and exit pkg/errors Panic and Recover Packages and Libraries Package aliases Imported unused packages for side effects Inspecting a package API Advanced Data Types Arrays Slices Extending slices Creating a slice with make Byte slices Maps Creating maps CRUD (create retrieve update delete) operations with maps Named types (user defined types) Function named type Type aliases Struct Struct embedding Field tags Struct methods Receiver Method Sets Interfaces Interface internals WARNING - dont assign nil variables to interfaces Type assertion Type switches Cool cool cool stdlib Tools Make Vim setup Libraries Data Middleware Web Effective Go is a howto on writing idiomatic Go.
Read more →

Go Web Apps

A quick tour of doing web with golang, all living off the land with Go’s built-in standard library. Packages Working example, where the web server and templating code in source file $GOPATH/src/github.com/bm4cs/gotime/web/server.go. It does lots of things, but exports function StartServer (upper case first character means publically exported). package web func StartServer() { … } The main func in $GOPATH/src/github.com/bm4cs/gotime/myapp/app.go can import the web package: import ( "github.com/bm4cs/gotime/web" ) func main() { web.
Read more →