The Best Go Content on the Internet


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...

TensorFlow and Go

Contributed by

This year I helped organize several online security challenges, one of which is Blacklight. Among the things I was asked to do, was creating a POC for a specific challenge, to prove that it’s possible to solve in a reasonable time. That challenge was one I face occasionally in my everyday life, not always with success: break a captcha. The task that requires breaking the captcha is disabling a security camera, to break into a room, without the security camera capturing your face.

Read more...

Using Go Templates

Contributed by

Go templates are a powerful method to customize output however you want, whether you’re creating a web page, sending an e-mail, working with Buffalo, Go-Hugo, or just using some CLI such as kubectl. There’re two packages operating with templates — text/template and html/template. Both provide the same interface, however the html/template package is used to generate HTML output safe against code injection. In this article we’re going to take a quick look on how to use the package, as well as how to integrate them with your application.

Read more...

Method Closures: You Can't Do That In Go

Contributed by

Neugram is a scripting language that sticks very close to Go. Go statements are Neugram statements, you can import Go packages, scripts can be compiled to Go programs, and types look just like the equivalent Go types at run time (which means packages built on reflection, like fmt, work as expected). These requirements put a lot of restrictions on the design of Neugram. This post is about one such restriction on methods that I did not discover until I tried to use it without thinking.

Read more...