The Best Go Content on the Internet


On the tension between generic code and special cases

Contributed by

The io.Reader and io.Writer interfaces appear in practically all Go programs, and represent the fundamental building blocks for dealing with streams of data. An important feature of Go is that the abstractions around objects such as sockets, files, or in-memory buffers are all expressed in terms of these interfaces. When a Go program speaks to the outside world, it almost always does so through io.Readers and io.Writers, irrespective of the specific platform or communication medium it uses.

Read more...

How to Send and Receive SMS: Implementing a GSM Protocol in Go

Contributed by

When developers add an SMS component in their app either for verification or notification purposes, they usually do it via RESTful API like the ones provided by Twilio. But what really happens behind the scenes? In this post, you’ll learn what Universal Computer Protocol (UCP) is and how you can use it to directly communicate with a Short Message Service Centre (SMSC) to send and receive SMS using Go.

Read more...

Golang and local datastores - fast and flexible data storage

Contributed by

Local datastores may not be a fit if you are building a web application that may have more than a single instance and a somewhat rich data schema. But they are an important building block to know if you are looking for real fast temporary storage or can build your own replication. In this post I will show how I’ve used key/value local databases in Go to build a database server named Beano that speaks Memcached protocol and can hot-swap its whole dataset gracefully.

Read more...

Best Practices for Using Mage To Build Your Project

Contributed by

On my team at Mattel, we have a magefile for every Go project (and we have several Go projects). Our use of mage has grown with the team and the projects, and it has been a big help keeping our dev practices uniform and shareable. Here’s how we do it. Retool One of the great things about Go is the tooling, not just the official tooling but all the community tooling.

Read more...

Postmortem debugging Go services with Delve

Contributed by

One day, several instances of one of our production services stopped accepting incoming traffic. HTTP requests successfully went through the load balancer reaching the instance and just hanged. What followed became an exciting exercise in debugging of a running production service written in Go. Below is a step-by-step guide that demonstrates the process which helped us in identifying the root causes of the problem. To make things easier we will take a simple HTTP service, written in Go, as our debugging target.

Read more...

Splitting Data with Content-Defined Chunking

Contributed by

In this post you’ll learn what Content-Defined Chunking (CDC) is and how you can use it to split large data into smaller blocks in a deterministic way. These blocks can be found again in other data later, even if the location of the block is different than the first time. I wrote a small Go package to do the splitting, which performs really well. Why is splitting data an interesting problem?

Read more...

New Go Community Code of Conduct

Contributed by

In November 2015, Google introduced the Go Code of Conduct (CoC) and as the leading Go language conference, it was important for us to set an example by publishing and enforcing this Code of Conduct to safeguard the dignity and well-being of all who work in the Go Community. However, as our community grows, things change, and our Code of Conduct should evolve as our community does. It was announced today that Google has updated their CoC and we believe our mission is best served in an environment that is friendly, safe, and accepting, free from intimidation or harassment.

Read more...

Simple messaging framework using Go TCP server and Kafka

Contributed by

I needed to create a simple framework to provide my endpoint devices ( doesn’t matter which platform they run on ) the option to send and receive messages from my backend. I require those messages to be managed by a message broker so that they can be processed in an asynchronous way. The system contains 4 main layers, this article section is mainly about the first one: 1. TCP servers - Needs to maintain as many TCP sockets in synch with the endpoints as possible.

Read more...

Go 1.10

Contributed by

Table of contents Language changes Operating Systems support Tooling Environment Variables go build go install go test gofmt go fix pprof Runtime CGO support Debugging Assembly support Packages Closing notes Introduction Go 1.10 is the first major release after the announcement of the plans towards Go 2.0 at GopherCon 2017. There are a number of exciting changes which I’ll cover below as well as some changes in the behavior of either tools or Go APIs which might result in an unexpected behavior compared to the previous change.

Read more...

Create a Slack bot with golang

Contributed by

Create a Slack bot with golang Introduction In this post we’ll look at how to set up a quick Slack bot that receives messages (either direct or from channel) and replies to the user. I’ve been an IRC user for many years and always loved setting up bots, whether for sports scores, weather, or something else entirely. Recently I’ve actually had an opportunity to implement my first Slack bot and figured I would document the process for others!

Read more...