The Best Go Content on the Internet


Extending Osquery with Go

Contributed by

What if you could use SQL to query any aspect of your infrastructure? Osquery, an open source instrumentation tool released by the Facebook security team allows you to do just that. For example, SELECT network_name, last_connected, captive_portal FROM wifi_networks WHERE captive_portal=1; will show all captive portal WiFi networks that a laptop has connected to. And SELECT * FROM processes WHERE on_disk = 0; will show any process that is running where the binary has been deleted from disk.

Read more...

Tracking the Stars

Contributed by

In April 2017, I thought it would be fun to try setting up a system to track the star counts of the top 1000 Go repositories on GitHub. This article describes how I collected this data and some simple analysis of the dataset. I want to be clear that this was for fun only and I’m not advocating that the number of stars a repository has is the be-all-end-all of its success.

Read more...

Accessing SMBIOS information with Go

Contributed by

While speaking with coworkers recently, one of them posed a question: How can we discover the capacity of each memory DIMM in a machine? Some veteran Linux users may be familiar with the dmidecode utility, which can access SMBIOS/DMI information exposed by hardware. This utility can expose a huge amount of information about the hardware and BIOS software on a machine. But how does it work under the hood? This post will explain how to access this information, and demonstrate the open source go-smbios package that can be used to retrieve and leverage this information in Go.

Read more...

Using Vue.js with Buffalo

Contributed by

When I’m writing web applications, I don’t tend use the latest JavaScript front-end hotness, instead I prefer to reload the entire page on a request, or at the most, a small section of it. Today, however, many developers love to write JSON back ends and write their front-end logic using JavaScript. In this article, we’re going to do just that. We’re going to create a small Buffalo application that speaks JSON, and we’ll create a small front-end to talk to that using Vue.js.

Read more...

Go and wasm: generating and executing wasm with Go

Contributed by

Today we will see how we can interact with WebAssembly, from Go: how to execute WebAssembly bytecode from Go and how to generate WebAssembly bytecode with Go. But first of all: what is WebAssembly? WebAssembly According to webassembly.org, WebAssembly (wasm for short) is a new portable, size- and load-time-efficient format suitable for compilation to the web. In a way, wasm is the next evolution of asm.js and PNaCl: it’s a new way to run code, on the web.

Read more...

Seeking around in an HTTP object

Contributed by

Imagine there’s a giant ZIP file on a HTTP server, and you want to know what’s inside it. You don’t know if it’s got what you are looking for, and you don’t want to download the whole thing. Is it possible to do something like unzip -l https://example.com/giant.zip? This is not a theoretical problem just to demonstrate something in Go. In fact, I wasn’t looking to write an article at all, except that I wanted to know the structure of the bulk patent downloads from the US Patent and Trademark Office (USPTO) from those ZIP files.

Read more...

unsafe.Pointer and system calls

Contributed by

unsafe is a Go package that, as the official documentation states, contains operations that step around the type safety of Go programs. As its name implies, it should be used very carefully; unsafe can be dangerous, but it can also be incredibly useful. For example, when working with system calls and Go structures that must have an identical memory layout to a C structure, you may have no choice but to resort to unsafe.

Read more...

Write a Kubernetes-ready service from zero step-by-step

Contributed by

If you have ever tried Go, you probably know that writing services with Go is an easy thing. Yes, we really need only few lines to be able to run http service. But what do we need to add if we want to prepare our service for production? Let’s discuss it by an example of a service which is ready to be run in Kubernetes. You can find all examples from this article in the single tag and you can follow this article commit-by-commit.

Read more...

gRPC Go: Beyond the basics

Contributed by

Introduction As a newcomer to gRPC (in Go) there are many resources setting out what gRPC is, where it originated from and how to create a basic service and client. After completing an introduction to gRPC and setting up a basic implementation I felt a bit lost as to where I need to go next. gRPC consists of more than just sending binary blobs over HTTP/2. gRPC is also a set of libraries that will provide higher-level features consistently across platforms that other libraries typically do not.

Read more...

How to Tokenize Complex Strings with Lexmachine

Contributed by

This article is about using lexmachine to tokenize strings (split up into component parts) in the Go (golang) programming language. If you find yourself processing a complex file format or network protocol this article will walk you through how to use lexmachine to process both accurately and quickly. If you need more help after reading this article take a look at the documentation, a tutorial, or an explainer article on how it all works.

Read more...