The Best Go Content on the Internet


Go and a Package Focused Design

Contributed by

Developers often tend to think about designing software in terms of using logical layers of abstractions. I have seen many Go projects with layers of abstractions that reflect grouping of all common things together such as types (model), handlers for all services (api or controllers), and even multi-purpose packages (util). These ways of organizing code are not putting Go package features to good use. With Go offering purposeful tools for designing code, its long-term success rests on our ability to make good use of these features so that we end up with software that is well designed and durable.

Read more...

Some Tools For Go That You Might Not Know Yet

Contributed by

Year’s end is coming closer. Time to clean up repositories and polishing up the toolset. All the well-known tools have been installed already–is there anything else to add to the toolbox? Here are a few useful tools that you might not have in your toolbox yet: interfacer, zb, realize, and binstale. They have nothing in common except that each of them solves a particular problem well. interfacer: Should I rather use an interface here?

Read more...

New features in go1.8 database/sql

Contributed by

database/sql has many new features to better enable writing and controlling queries. In short it adds support for: Cancelable queries Returning the SQL database types Returning multiple result sets Ping hitting the database server Named parameters Transaction isolation levels Cancelable Queries There is now support for Context for most database methods. Why would you want to use them? Context allows queries to be canceled while they are running. Reasons queries may block: If a connection pool is starved it may wait indefinitely for a free connection.

Read more...

Contributing to the Go project

Contributed by

Contributing to the Go project can seem overwhelming, especially at first. The official Contribution Guidelines document is rather lengthy, but after working through the initial Google CLA and Gerrit authentication process, it becomes much easier to contribute to the project. This post will attempt to demystify the process behind contributing to the Go project, in an effort to encourage all Gophers to try to tackle an issue or solve a bug upstream for the benefit of others.

Read more...

QPID - Go Powered BBQ

Contributed by

Two of my favorite things to do are write Go code and make BBQ. This fall, I started a project that combined these passions into an interesting project. When I got a new BBQ grill this year, I wanted to find a way to control the temperature of the fire box programmatically. Some Internet research led me to Justin Dean’s PitmasterPi project. It’s written in Python, but Justin was kind enough to include a great writeup on both the software and hardware he used to control his grill.

Read more...

Using NATS Messaging with some of your favorite Golang tools

Contributed by

Quick Intro to NATS, and Why We Love Go! For those of you who have been reading GopherAcademy for a while, you may already be familiar with NATS via last year’s post, or you may have known about NATS for a while before that - NATS was one of the earliest production applications written in Golang. NATS is a very, very simple messaging system (just like Go is a simple to use development language), and shares many of the same characteristics developers like about Go.

Read more...

Using Go's 'context' library for making your logs make sense

Contributed by

One of the shiny new toys in Go 1.7 is the ‘context’ library. Not shiny as in it is genuinely new. It started out at golang.org/x/net/context, which is where you’ll need to import it from if you’re on 1.6 or before - but don’t worry, the old import path is completely forwards compatible. This library has been considered significant enough to make it into the standard library, and for good reason.

Read more...

How Do They Do It: Timers in Go

Contributed by

How Do They Do It: Timers in Go This article covers the internal implementation of timers in Go. Note that there are a lot of links to Go repo in this article, I recommend to follow them to understand the material better. Timers Timers in Go just do something after a period of time. They are located in the standard package time. In particular, timers are time.Timer, time.Ticker, and less obvious timer time.Sleep.

Read more...

Go, Nginx, and TLS Termination

Contributed by

With the advent of Let’s Encrypt, it’s now easier than ever before to ensure all of your web applications and services are behind HTTPS. However, many times it’s hard to realize the performance impact and overhead of using HTTPS on your applications. Should you terminate in Nginx? Go? Stunnel? ELBs? Luckily, it’s fairly easy to find out with a simple benchmark. We’ll put a Hello World server, written in Go, behind Nginx, set up as a TLS-terminating reverse proxy, and compare that to the native http.ListenAndServeTLS.

Read more...

Writing Go assembly functions with PeachPy

Contributed by

What is PeachPy PeachPy is a Python-based framework for writing modules in assembly. It automates away some of the details and allows you to use Python to generate repetitive assembly code sequences. PeachPy supports writing modules that you can use directly from Go for x86-64. (It also supports NaCl and syso modules, but I won’t cover those in this post.) This post is going to be mostly about what you need to know about integrating PeachPy and less a tutorial about PeachPy specifically.

Read more...