Recent Posts
Struct Tags, JSON, and Validation
Contents Structs in Go Struct Tags and JSON in Go Validating struct tags Example Code Final Note References Structs in Go One of my favorite things in Go, is how simple it is to serialize/deserialize things like JSON responses. Coming from languages where parsing things like this can be difficult, I’ve found doing so in Go is quite intuitive!
While Go does not have classes, it does have the concept of structs.
read more
Override Defaults
Overriding default values in an object One of the patterns or idioms I’ve enjoyed in Go is the concept of a NewType() constructor function building and returning an instance of your struct.
Without classes in Go, developers using our package would have to ensure they construct an object instance properly. Using the above pattern however, we ensure it’s done in a uniform way each time.
However what if we want to override some default assigned value, such as a Logger, or an HTTP client, with an implementation of our choosing?
read more
Hello World
Hello World! So recently I read a post by Scott Hanselman about how we really should be owning our own content. Domain names and blogs are easy to get started, and the benefit is all your content is owned by you.
You can then post about it on your favorite social media platform, but should you ever lose access to that platform, the content you’ve curated is still available.
In that vein I have owned altf2o.
read more