#281 — September 27, 2019

Read on the Web

📣 In this issue we have an interview with the author of Head First Go! Head down to the very bottom of this issue to check it out.

Golang Weekly

Watermill 1.0: A Go Library for Working Efficiently with Message Streams — We first linked to its launch post a year ago, but this library for building event driven apps has come a long way and reached the all important 1.0 milestone.

Three Dots Labs

Using Go Instead of Bash for Scripts — It’s not a bad idea, especially if you have a love/hate relationship with bash like us. Krzysztof covers conventions and sharing utility functions. Mage is also worth checking out if you sink down this particular rabbit hole.

Krzysztof Kowalczyk

Level Up Go Test with gotestsum — Since go test doesn't output in the JUnit format natively, use gotestsum to do that for you.

CircleCI sponsor

Go 1.13.1 and 1.12.10 Released — These are minor releases to address a recently reported security issue in net/http where invalid HTTP/1.1 headers could be accepted and normalized.

Filippo Valsorda

The Go Proposal Process: Enabling Experiments — The latest in Russ Cox’s series of posts about how the Go core team and community can think about, work with, and develop new ideas for the language. This time, he thinks about how best to run experiments for proposed features.

Russ Cox

Ristretto: A High-Performance, Concurrent, Memory-Bound Cache — The folks at Dgraph needed a better cache and couldn’t find one in the community. So, they wrote one. Note that it’s a local, per-process cache and not server-based (as yet).


💻 Jobs

Golang Developer at X-Team (Remote) — Join the most energizing community for developers. Work from anywhere with the world's leading brands.


Find a Go job through Vettery — Vettery specializes in tech roles and is completely free for job seekers. Create a profile to get started.


📘 Articles & Tutorials

Be Wary of Functions Which Take Several Parameters of the Same Type — Dave has an opinion of one way to handle this, are there others?

Dave Cheney

A Comprehensive Guide to Working with WebSockets in Go — A practical and thorough introduction to WebSockets, how they work under the hood, and working with them in Go code.

Aleksandr Ryzhyi

Understanding Package Visibility in Go — How to share code between packages while also protecting the implementation details of your package.


New Public Go, Docker and Kubernetes Training Are Available for You

Ardan Labs sponsor

Managing Groups of Goroutines in Go — The article covers the typical WaitGroup approach, adding in how to handle errors and context.

Michal Bock

Using io.Reader/io.Writer to Stream Data

Dávid Mikuš

▶  A Look At Dgraph: The Graph Database Written in Go — Did you know that Francesc Campoy (of JustForFunc fame) now works at Dgraph on their Go-powered graph database? I didn’t, but it’s great to see him in a new video.

Francesc Campoy

🛠 Code & Tools

Ants 2.0: A High-Performance Goroutine Pool — If your program is designed to generate a large number of goroutines, Ants can automatically manage and recycle them.

Andy Pan

v8go: Execute JavaScript from Go — Lets you create V8 contexts and run code eval-style. Prebuilt static versions of V8 are included for Linux and macOS so you shouldn’t need to build V8 for yourself.

Roger Chapman

Test Mux Video for Your Go App for Free ✨ — Easily build beautiful video experiences into your Go app. Create a free Mux account with no payment information needed.

Mux sponsor

Stateless: A Fluent Library for Creating State Machines — It supports almost the same API as a similar project in C#.

Quim Muntal

xurls: Extract URLs From Text (using Regexes) — The regexes themselves are more precise than you’d guess.

Daniel Martí

Fake 'Generics' Using Canadian Syllabics ᐸ..ᐳ — They look like angled brackets, but they’re not. Yes, this is just a fun, little, tongue-in-cheek project.

Pavel Vasilev

Gizmo: A Microservice Toolkit from The New York Times

The New York Times

Jay is serious about teaching others to code. Before Head First Go, he wrote a book about Ruby called (wait for it...) Head First Ruby. Jay believes everyone should know how to code, and has four years of experience teaching coding online.

Your first book was about Ruby. What prompted your interest in Go?

Ruby's a great language but it's hard to distribute finished applications. Not only do your users need to have a Ruby interpreter installed, they also need all the gems (libraries) installed that your app relies on. People have created solutions for this (like Bundler), but those solutions are still complex. Contrast this with Go, which compiles your code and all its dependencies down to a single executable. Give your users that compiled program, and they can run it even without Go installed. That's incredibly attractive if you want to create programs for distribution.

Is Go a suitable first language for new developers?

Simplicity is a primary goal in Go's design, so I think it's one of the best languages for new developers! For example, Go has only 25 keywords. Contrast that with Python (33 keywords), Ruby (39), or JavaScript (64). There's more to measuring a language's complexity than just keyword count, of course, but so many other aspects of Go are easier, too. You don't have to figure out class-based inheritance, or control flow with exceptions. Go code is just so much simpler and clearer.

What strikes you as the most difficult aspect of Go to learn?

Goroutines and channels. Go makes concurrency easier than many other languages, but it's an inherently difficult topic that can't be simply glossed over. The concurrency chapter for Head First Go had to spend a great many pages demonstrating potential pitfalls and their solutions. Fortunately, that comes late in the book, after we've already given readers the tools they need to make sense of it all.

What excites you most about Go 2.0 and beyond?

This might not be the most exciting answer, but I like the careful, thoughtful way the Go team is handling the introduction of new features. They're requiring lots of experimentation and feedback before anything makes it into an official release. I want future Go versions to have the same simplicity and ease of use that the early releases had. Thankfully, we seem to be on the right track to make that happen!

You can learn about Head First Go at headfirstgo.com or follow him @jaymcgavren.