November 2017
Intermediate to advanced
670 pages
17h 35m
English
Let's examine our chapter4 implementation, starting with main.go:
package mainimport ( . "github.com/l3x/learn-fp-in-go/chapter4/01_hof" "log" "os" "github.com/julienschmidt/httprouter" "net/http")
The dot (.) in the . "github.com/l3x/learn-fp-in-go/chapter4/01_hof" import keeps us from having to preface the functions in that directory with hof, which is the package name used by all the Go files in that directory:
func init() { log.SetFlags(0) log.SetOutput(os.Stdout)}
We'll use the log package to log output to stdout. Passing a 0 value to log.SetFlags tells the logger to print without prepending timestamps. We also tell the logger to print to stdout, rather than the default stderr because we want all of the ...