The Best Go Content on the Internet


The Relationship Between Interfaces and Reflection

Contributed by

Interfaces are one of the fundamental tools for abstraction in Go. Interfaces store type information when assigned a value. Reflection is a method of examining type and value information at runtime. Go implements reflection with the reflect package which provides types and methods for inspecting portions of the interface structure and even modifying values at runtime. With this post I hope to illustrate how parts of the interface structure relate to the reflect API and ultimately make using the reflect package more approachable!

Read more...

Debugging with Mozilla rr project and GoLand

Contributed by

Debuggers. Traditionally they are used to find complex bugs and reason about how they happen. But what if you cannot explain why some changes happen between steps? This is where a classic debugger would fail to help you as they usually allow you to only move forward with the execution. While you can use core dumps, as we’ve seen in the previous article, they do not always tell you the full story of what’s going on in your application.

Read more...

Exploring byte parsing APIs in Go

Contributed by

Several years ago, I began exploring Linux’s Netlink inter-process communication interface. Netlink is used for retrieving information from the Linux kernel, and in order to cross the kernel boundary, information is typically packed into Netlink attributes. After some experimentation, I created my own netlink package for Go. Over time, the APIs in the package have evolved considerably. In particular, Netlink attributes have always been reasonably complicated to handle. Today, we’ll explore some of the byte parsing APIs I’ve created for dealing with Netlink attributes.

Read more...

Bringing Sanity to your Dependencies with Go Modules and Athens

Contributed by

As many of us know, Go version 1.11 introduced Go Modules, a brand new dependency management system. A Little Bit About Modules Before 1.11, our dependencies were a collection of Go packages with a single version number attached to all of them. As packages evolved, their versions were changed. Tools like Godep, glide, gb and dep made it really easy for us to fetch all the packages that our apps needed, at the versions we needed.

Read more...

gpython: a Python interpreter written in Go "batteries not included"

Contributed by

Gpython is a Python 3.4 interpreter written in Go. This is the story of how it came to be, how it works and where it is going. This includes a quick run through how an interpreted language like Python/Gpython works with a dip into the Virtual Machine (VM), lexing source, parsing it and compiling to byte code. Genesis In 2013 I had a health problem which meant I needed to take 3 months off work, so I needed a project to take my mind off things.

Read more...

Improve Your Breadmaking Skills with Go and Open-Source Monitoring

Contributed by

I have many different interests, including baking, open-source software, and more recently, systems monitoring and learning Go. As a way for me to expand my practical knowledge on each item, I devised a fun little project that leverages sensors, Raspberry Pis, and Prometheus to improve my sourdough breadmaking process. I will explain the inspiration behind it, go through the steps I took to set up the project, and detail what I learned.

Read more...

Creating WebGL apps with Go

Contributed by

TL;DR In this article I’ll share my experience building an interactive 3D WebGL-based application for peer-to-peer messaging protocol simulation without writing any single line in JS. You’ll learn how GopherJS and Vecty framework can dramatically lower the complexity of building WebGL-enabled web apps in Go. It’s often said “A picture is worth a thousand words”, but in the era of high-DPI screens and big data, the new idiom is now truer – “3D interactive visualization is worth a thousand pictures”.

Read more...

Building a CI/CD Bot with Slack and Kubernetes.

Contributed by

This article is about an experiment at Africa’s Talking on using Slack to manage our deployment process. Like many companies, we use Kubernetes to manage our deployments, and Slack for internal communications. We decided to investigate how we can use Slack to improve our deployment process and structure the communications needed for a deployment. The Structure At Africa’s Talking, each project is written with comprehensive unit testing, also, before a change is approved, several people have to take a look at it and do some manual testing themselves.

Read more...

A Dive Into the `fmt` Package

Contributed by

We usually use the fmt package without giving it much thought. A fmt.Printf here, a fmt.Sprintf there and on we go. However, if you’ll take a closer look, you’ll be able to get much more out of it. Since Go is used a lot to write servers or services, our main debugging tool is the logging system. The log package provides log.Printf which has the same semantics as fmt.Printf. Good and informative log messages are worth their weight in gold and adding some formatting support to your data structure will add valuable information to your log messages.

Read more...

Go and WebAssembly: running Go programs in your browser

Contributed by

For a long time, Javascript was the lingua franca amongst web developers. If you wanted to write a stable, mature web app, writing in javascript was pretty much the only way to go. WebAssembly (also called wasm) is going to change that soon. Using WebAssembly one can write web apps in any language now. In this post, we will see how to write Go programs and run them in the browser using wasm.

Read more...