© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
A. FreemanPro Gohttps://doi.org/10.1007/978-1-4842-7355-5_9

9. Using Function Types

Adam Freeman1  
(1)
London, UK
 
In this chapter, I describe the way that Go deals with function types, which is a useful—if sometimes confusing—feature that allows functions to be described consistently and in the same way as other values. Table 9-1 puts function types in context.
Table 9-1

Putting Function Types in Context

Question

Answer

What are they?

Functions in Go have a data type, which describes the combination of parameters the function consumes and the results the function produces. This type can be specified explicitly or inferred from a function defined using a literal ...

Get Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.