Skip to Content
Learning Functional Programming in Go
book

Learning Functional Programming in Go

by Lex Sheehan
November 2017
Intermediate to advanced
670 pages
17h 35m
English
Packt Publishing
Content preview from Learning Functional Programming in Go

The chapter4 application code

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781787281394Supplemental Content