Go Walkthrough: encoding/binary
When you need to squeeze every last bit or CPU cycle out of your protocol, one of the best tools is the encoding/binary [https://golang.org/pkg/encoding/binary/] package. It operates on the lowest level and is built for working with binary protocols. We previously looked at using
Go Walkthrough: encoding/json
For better or for worse, JSON is the encoding of the Internet. Its formal definition is small enough that you could write it on the back of a napkin but yet it can encode strings, numbers, booleans, nulls, maps, and arrays. Because of this simplicity, every language has a JSON
Go Walkthrough: encoding
So far we’ve covered working with raw byte streams and bounded byte slices but few applications simply shuttle bytes around. Bytes alone don’t convey much meaning, however, once we encode data structures on top of those bytes then we can build truly useful applications. This post is part
Standard Package Layout
Vendoring. Generics. These are seen as big issues in the Go community but there’s another issue that’s rarely mentioned — application package layout. Every Go application I’ve ever worked on appears to have a different answer to the question, how should I organize my code? Some applications push
Go Walkthrough: bytes + strings
In the previous post we covered byte streams but sometimes we need to work with bounded, in-memory byte slices instead. While working with a list of bytes seems simple enough, there are a lot of edge cases and common operations that make using the bytes [https://golang.org/pkg/bytes/
Go Walkthrough: io
Go is a programming language built for working with bytes. Whether you have lists of bytes, streams of bytes, or individual bytes, Go makes it easy to process. From these simple primitives we build our abstractions and services. The io package is one of the most fundamental packages within the
Structuring Applications in Go
For me, the hardest part of learning Go was in structuring my application. Prior to Go, I was working on a Rails application and Rails makes you structure your application in a certain way. “Convention over configuration” is their motto. But Go doesn’t prescribe any particular project layout or