#351 — February 26, 2021

Unsubscribe  |  Read on the Web

Go Weekly

'Go is not an easy language.' — The syntax is simple, the semantics are simple, but doing useful stuff is ‘not always easy in Go.’ The point made by the author here is rather simple IMHO, but it provoked some interesting discussion (423 comments!) on Hacker News. Maybe Go is like the guitar.. easy to learn but hard to master?

Martin Tournoij

A Proposal to Add Fuzzing to the Go Standard Library — Fuzzing is a type of testing that mutates inputs to a program under test to catch issues that common testing or humans would miss. The proposal is targeting Go 1.17 as an experimental feature and there’s a design draft here.

Katie Hockman

Combining GoLang, REST, NoSQL and Serverless — Connect your Go service, CLI or app to an automatically generated GraphQL data access API for your NoSQL DBaaS in < 5 minutes. Astra is cloud delivered, Kubernetes based & developer ready. | Get your free forever cluster running in a few clicks.

DataStax Astra sponsor

Contexts and Structs — A new post on the official Go blog digging into context.Context and why contexts should be explicitly passed around to functions that need it rather than tucked away inside a struct.

Jean de Klerk and Matt T. Proud

A Rundown of What's New in Go 1.16 — Last week we featured the release of Go 1.16 but this post takes a more accessible walk through a few of the updates.

Ayooluwa Isaiah

💡 We have an interview at the end of this issue — check it out :-)

📘 Tutorials and Stories

The Life of an HTTP Request in a Go Server — Eli continues his streak of solid blog posts with a look at the route a typical HTTP request takes through a Go server.

Eli Bendersky

Injecting Values into Variables at Build Time — What if you want to set the value of certain variables without those values being present in source control? You could load them in at runtime, or… use the -X option of Go’s linker.

Oliver Leaver-Smith

Visualize Golang Performance End-To-End with Datadog APM — Datadog's distributed tracing and APM generates flame graphs from real requests, enabling you to visualize app performance in real-time.

Datadog APM sponsor

Writing a Simple TCP Server Using Kqueue — Kqueue provides event notification functionality to FreeBSD-based operating systems and writing a basic echo server is a good way to learn how it works.

Frank Rosner

Building Solid Go GraphQL Applications Quickly — Some thoughts from someone who’s been there. Testing is the key to confidence, Peter reckons.

Peter Ohler

Context and Variables in the Hugo Static Site Generator — Hugo is a popular static site generator built in Go and this tutorial introduces some more advanced concepts around how Hugo handles context.

Kristian Lumme

Rapidly Developing Go Microservices on Kubernetes with Telepresence — Written by a developer advocate promoting Telepresence, a (commercial) tool this tutorial is oriented around, so keep that in mind.

Peter O'Neill

Why a Team is Switching From C# to Go for Backend Development

Phil Richards (Aluma)

🛠 Code & Tools

Dither: A Fast and 'Correct' Image Dithering Library — There’s something about a well dithered image that takes me back to the 1990s :-) This library supports quite a few approaches.

Makeworld

GoMock 1.5.0: A Mocking Framework for Go — Has two modes of operation: source and reflect. Source mode generates mock interfaces from a source file. Reflect mode generates mock interfaces by building a program that uses reflection to understand interfaces.

Go Project

Video for Your Go App That Streams Beautifully, Everywhere

Mux sponsor

Redigo: A Go Client for Redis — Supports all the Redis commands through a Print-like API and also offers connection pooling, helper functions for handling replies, and pipelining support.

Gary Burd

go-ipfs 0.8.0: An IPFS Implementation for Go — IPFS (InterPlanetary File System) is a peer-to-peer protocol and network for organizing a distributed file system. v0.8.0 of this Go implementation has added quite a few new features.

Go IPFS Community

Sloc, Cloc and Code (scc) 3.0: A Fast Accurate 'Code Counter' — For multiple languages, counts lines of code and estimate code complexity. v3.0 moves things up to Go 1.16, adds M1 and ARM support, and more.

Ben Boyter

💻 Jobs

Sr. Software Engineer at CrowdStrike (Remote) — CrowdStrike is the leader in cloud-delivered endpoint protection, which helps protect our customers from cybersecurity attacks.

CrowdStrike

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

Find Your Next Job Through Hired — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers.

Hired

...who has created an extremely impressive array of Go learning resources, including an open-source repository with over 1000 exercises, an in-depth online course, a YouTube channel and, a blog.

We're grateful that he's taken the time to answer a few questions today:

Which of your various attempts to get folks to learn Go is the most effective?

The most effective way for me was to understand Go deeply and then use it in the real-world to solve problems. I started porting a large Node.js codebase to Go and contributing to the core Go language as well. After having a decent amount of real-world experience in Go, I decided to help others, and I started creating educational materials around Go.

What is the biggest hurdle for programmers learning Go?

Go is simple, but it's not easy. It has its own way of thinking. It would help if you can unlearn to learn again. I mean, it's hard to break old habits. For example, I think you shouldn't try to apply the same DDD and OOP patterns from your other language. You'll probably be frustrated, and there's no need. I see many repositories with thousands of stars, showing people how to implement those things in Go. I think they are doing more harm than good.

Go is so simple that you need to start thinking simple and finding simple solutions. Otherwise, it's easy to make things worse.

My advice to newcomers, don't complicate things from the start. Start simple and carve your way out from there. Don't assume everything will get better by using something like "standard project layout" or "clean architecture," etc. On the contrary, you can make things more difficult for yourself. Instead, invent your own for your specific use case, do not fear. Trust your instincts. Here are some resources to get you started in Go.

What excites you most about Go's future?

When people say, Go is boring, I say it's a feature, not a bug. It is the most boring language I've ever used in my 30 years of development career. Go is so simple that there is "almost" nothing to take away from it.

Although I would choose not to change the language, this is inevitable because I'm not the only person using it. So understandably, others have different needs than mine. Fortunately, the Go ecosystem is very democratic, and we gophers can shape the language. I'm grateful to the Go team because they are meticulous when adding new features.

Have you started making materials for Go 2.0? Generics?

Yes, I usually use Twitter to share my content. I was tweeting about it before the generics became a thing. Some of my recent tweets about generics: one and two.

What is your favorite Go language feature?

Like many others, I came to Go for the first-class concurrency support but stayed for its simplicity. So, my favorite Go language feature is interfaces, simple and also powerful. In some aspects, Go sits in a sweet spot between Python and C: it's simple to use but also efficient. For example, Go interfaces support duck-typing, and at the same time, they are type-safe.

You can find Inanc on Twitter here.