Go R1 Day 14
Day 14 of 100
- Migrated my new aws lambda logger from zap to zerolog. Zap gave me some problems initially so zerolog is my favorite structured logger right now, much simpler.
go-taskrunner file for launching go test and go build/run.
- Structured logging required a little bit of refactor but worked.
Here’s an example of providing back a logged string (don’t log secrets normally, but I’m in testing phase) with structure.
Based on my improved understanding of conversions vs type assertions, the need to convert using a “cast” (Go calls these conversions, and yes it makes a copy in memory for this):
Type assertions are done when working with an interface. I’m still working on my understanding of interfaces as they are their own beast in Go. Unlike most other languages, a Go type implements an interface when all the required methods are matched. This provides a great deal of the flexibility in Go interfaces.
The scoping of the interfaces is important, and while I listened to a lecture on this, I didn’t yet work through the interface design principles to ensure the best resusability/narrowness of scope concepts. I think that’s going to take more “getting my hands dirty” for it to click.