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

A conversation - Java developer, idiomatic Go developer, FP developer

Developer

Says...

Java

I do not like the way Go makes me handle errors after every function call.

I want exception handling like this:

try {   Decrypt()   Authenticate()   Charge()}catch (Exception e) {   // handle exception}

However, after adding all those error checks, my code looks like this:

err := Decrypt()if err != nil {   return err}err = Authenticate()if err != nil {   return err}Charge()

Go error handling looks like a bunch of scaffolding obscuring my code's intentions.

Go

As you know, Go does not support exception handling. Instead, you return errors to inform ...

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