#​359 — April 23, 2021

Unsubscribe  |  Read on the Web

⭐️ This week we're lucky to have been able to interview Jon Bodner, the author of Learning Go which has just been published by O'Reilly. Check it out at the end of the issue and find out what Go features you should be avoiding :-)
__
Peter Cooper, your editor

Go Weekly

Go 1.17 (..Hopefully) to Provide Better Performance via Register-Based Calling Convention — The details (which are quite technical) are all in this GitHub issue, but the takeaway is in the headline. More performance is good and a 6.5% bump is suggested here. This is on AMD64 for now, but ARM64 is the next architecture they’re planning to work on.

Go Team

Maybe Go Executable Files Aren't Full of 'Non-Useful Bits' — Last week we featured an update to 2019’s Why are my Go executable files so large? where the author argued that modern Go binaries continue to be full of ‘non-useful bits.’ This article has now become a retraction as Russ Cox hit Hacker News to clear up what was going on, noting that the piece was ‘full of misinformation.’

Russ Cox

The Sooner a Build Turns Red, the Sooner You Can Unblock Your Pipeline — The ability to cancel builds as soon as possible provides developers with a quicker feedback loop, saving time and reducing the cost of running agents.

Buildkite sponsor

Excelize 2.4.0: A Library for Reading and Writing Excel Files — Read and write XLSX files, set and read cell values, add charts. This latest release adds a lot with support for 152 formula functions, a new API to get rich text from cells, and lots of bug fixes.

360 Enterprise Security Group, Endpoint Security, inc.

Go 1.17 Will Allow Converting a Slice to an Array Pointer — Well, sometimes. 1.17 adds this ability without using reflect or unsafe, but there are some cautions to note.

Chris Siebenmann

📘 Tutorials and Stories

Writing Good Unit Tests; Don't Mock Database Connections — While most of this post is 101 stuff, the take on mocking external dependencies might generate some opinions.

Lane Wagner

Seven Years of Open-Source Database Development: Lessons Learned — The developer of rqlite, a Go-powered, distributed SQLite-backed database system, has some high-level reflections on what it’s like to work on such a project.

Philip O'Toole

How to Scale Prometheus (Hint: It’s Not Prometheus)

Lightstep sponsor

Go Generics Beyond the Playground — Sindre attempts to rewrite a test matcher library using generics, diving into how they solved the problem pre-generics and what is possible now.

Sindre Myren

▶  Talking TCP and UDP with Adam Woodbeck — Along with the author of Network Programming with Go, the Go Time podcast heads into the thorny weeds of networking with a look at two protocols that the entire Internet relies upon.

Go Time Podcast podcast

Concurrent API Patterns in Go — Five simple rules (using three steps) to follow for building concurrent, leak-free API code.

Mark Salpeter

Jobs

Senior Software Engineer at Even (Anywhere) — Help end the paycheck-to-paycheck cycle. Build w/ Go, React Native, GraphQL, Postgres, Bazel. Remote encouraged.
Even

Senior Software Engineer (Go) - 100% Remote, UK/EU Only — Solving complex technical challenges using the latest, cloud-native technologies to help Banks and FinTechs move money faster.
Form3

Golang Developer at X-Team (Remote) — Join the most energizing community for developers and work on long-term projects for Riot Games, FOX, Sony, Coinbase, and more.
X-Team

🛠 Code & Tools

Vugu: Vue-Like Frontends in Pure Go, HTML, and CSS — We called this ‘bleeding edge’ two years ago and it’s still a pretty novel idea. Vugu targets WebAssembly, so it will work in the latest major browsers but is also still a bit gooey in the middle. More discussion here on Hacker News.

Vugu

Tunny: A Goroutine Pool Library — A library for spawning and managing a pool of goroutines such as for when you need to limit the concurrent processing of jobs.

Ashley Jeffs

Book a Demo. Ship Fast. Rest Easy. LaunchDarkly — Testing in production is scary until it's not. Get control of your code to reduce risk & reclaim your nights and weekends.

LaunchDarkly sponsor

xsek: An (Almost) Compliant XPath 1.0 Library — It’s really only missing one bit (but it adds others) and it’s extensible so you might be able to make “almost” into “entirely.”

Chris Trenkamp

Fiber 2.8.0: An Express.js Inspired Web Framework — If you know Express (from the Node world) than Fiber will look very familiar.

Fiber

sx: Fast, Modern, Easy-to-Use Network Scanner — Handles ARP, TCP, UDP, ICMP scans and more.

v-byte-cpu

Raft 1.3.0: A Go Implementation of the Raft Consensus Protocol
HashiCorp

gronx: Fast, Dependency-Free Cron Expression Parser
Jitendra Adhikari

Jon is an avid Gopher, author of the recently released Learning Go book, and a Distinguished Engineer at Capital One, working on technical problems, code reviews, mentoring, and the odd spot of coding too.

We caught up with him to ask a few questions about his new book, which came out last month:

How did you end up writing Learning Go?

Learning Go by Jon Bodner

The short answer is that I went to a baseball game during GopherCon 2019.

The longer answer is a chain of events: I spoke at GoCon Canada 2019 and Carmen Andoh from the Go team was there. We’d met before and I mentioned that I was interested in writing a book on Go for developers who were learning it as a second language. At GopherCon 2019, Carmen told me that there was an editor from O’Reilly and I should go talk to her. I met up with Zan McQuade, an acquisitions editor at O’Reilly, and talked about my ideas for a book. We are both big baseball fans, so we went to a Padres-Giants game along with a few other Gophers — we talked baseball and books. Then exchanged a couple of follow-up emails, I submitted a proposal, and it was accepted.

What feature in Go do you think is underused by developers and deserves more attention?

Wrapping errors and using errors as values and not just strings. Including contextual information and using types and instances of errors.

What's your favorite Go idiom?

I’ve really come to love implicit interfaces. I think they are actually the most important feature in Go. Implicit interfaces are type-safe duck typing, which is kind of the best of static and dynamic typing.

What features in Go do you think most Go devs should avoid?

I call out a few of them in the book. Complex numbers were an interesting idea, but they should probably be avoided. init functions are almost always the wrong choice, and declaring multiple init functions in the same package is certainly a bad idea. You probably shouldn’t use goto, but it’s there for rare corner cases. Naked returns are a bad idea. However, if I could remove one feature from Go, it’d be shadowing. Most of the time, you really don’t want a name in an inner scope to cover access to names in outer scopes.

Do you have any plans to write another book one day?

I’ve been telling people that my next book is going to be a romance novel. I figure there will be less time spent making sure that I got all of the details right.

You can find out more about Jon's work via his GitHub profile or see his various talks on YouTube. He also blogs over on Medium.