Original post

Here is a basic example of how an anonymous function, or lambda function, can be used with go. We’re just printing a statement to screen, but it can be used for various things – one of which could be just to segment code which will only need to get run once and doesn’t need to be referenced.
It also has the use case of encapulating the variables used within itself, so only from within are you able to access a variable from within.