top of page
Image-empty-state.png

Carson Anderson

Weave

Carson is a fixture in the local Kubernetes and Go meetups. He has also been working tirelessly for the last 4 years to help build Weave's a Developer Experience Platform.

Stop Sleeping On First Class Functions!

Go has so many great features that draw us in: Channels, Goroutines, static compilation, a simple syntax, etc. But there is one feature that Go supports which needs more love: first class functions. This feature is not unique to Go, and with all the other shiny features to talk about, I think it is all too often overlooked and underutilized. First class functions (functions as variables) and closures (capturing data in those functions) are two incredibly powerful features that are built right into Go. But even seasoned Go developers often forget these features. We need to fix this!
We are going to go over several cases where these two features massively improve code usability and readability:

- Dependency Injection
- Passing functions as arguments to make our code testable
- Cleaning up Go templates
- Reducing complexity in templates with closures
- Hiding channel usage
- Stop passing channels, pass functions
- Building an execution pipeline
- Making ordered operations easy and extensible

bottom of page