We're working on something new! Hook Relay gives you Stripe-quality webhooks in minutes. Sign up for free today! Check out Hook Relay

Go News Brief (Q3 2021)

Several releases this quarter include compiler improvements, 64-bit ARM support on Windows, and conversions from slice to array pointer, among others. Memory management and performance optimization are popular topics, plus this month's top articles and guides.

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

GopherCon Brazil 2022 on April 29-30, 2022

GoWest Conference 2021 on October 22nd, 2021 online

GopherCon 2021 on December 5-8, 2021 in San Diego, CA

Golang Conference 2021 on December 13-14, 2021 in Moscow

Security

  • 2021-09-15: in-toto-golang is a go implementation of the in-toto framework to protect software supply chain integrity. In affected versions authenticated attackers posing as functionaries (i.e., within a trusted set of users for a layout) are able to create attestations that may bypass DISALLOW rules in the same layout. An attacker with access to trusted private keys, may issue an attestation that contains a disallowed artifact by including path traversal semantics (e.g., foo vs dir/../foo). Exploiting this vulnerability is dependent on the specific policy applied. The problem has been fixed in version 0.3.0.

Projects

Golang 1.17 Released

Biggest improvements & changes:

  • Compiler improvements yielding ~5% performance gain
  • 64 bit. ARM support on Windows
  • Pruned module graphs in Go 1.17 modules
  • unsafe.Add and unsafe.Slice

Deps.dv

This is an experimental project by Google that scans places like GitHub and pkg.go.dev for package info, determines full dependency graphs, and then lets you navigate this data.

Go 1.17 RC 1 Released

You can read the draft release notes here Changes of note include:

  • Conversions from slice to array pointer
  • unsafe.Add
  • unsafe.Slice

GoLand 2021.2 Released

New features for Go modules, a new option for formatting and support for Go 1.17 features.

Go 1.16.7 and 1.15.15 Released

Minor point releases

Memory Management

  • Interesting Go Memory Issue

    • Ben E.C. Boyter
    • Very short piece, but does have a link to an older, longer article regarding how Twitch reduced CPU utilization for one of their API's by 30%.
  • Updating the Go Memory Model

    • Russ Cox
    • This is part 3 of a series regarding memory models. Part 1 was focused on hardware, and part 2 programming language memory models. I decided to highlight the last post since it is the most focused on Golang. The article discusses Go's design philosophy, and then discusses several recommendations including adding unsynchronized atomics, a typed API to the sync/atomic package as well as documentation to the model for happens-before for sync and sync/atomic packages.

Performance optimization

  • Inside sync.Map
    • Sreram K
    • Long, in-depth article regarding sync.Map.. how it is used and how it works. It also discusses how a sync.RWMutex guarded map is a lot better than sync.Map when only using a few processor cores. Beyond four cores, though, the performance of sync.Map is significantly higher than a map guarded by sync.RWMutx.
  • A Tale of Two Copies
    • Jeff Wendling
    • Discusses a situation that the author encountered at work when working on code to take entries, append them into a fixed size in-memory buffer, and then flush that buffer when it was full. When benchmarking, he noticed that there was a 2x difference in performance where the benchmark writing to disk more is faster which was confusing so he started to dig in. Fun post that I'm sure many can relate to as it relates to going down a rabbit hole trying to understand why something is happening.

Standout Content

  • Go Training
    • Ardan Labs
    • This is a comprehensive list of books, blogs, interviews, articles, case studies and lots more. Definitely worth a bookmark!
  • There Are Many Ways To Safely Count
    • Bruno Calza
    • Neat article that shows different ways to implement counters, as well as how not to do it. Includes examples of utilizing channels as well as the sync/atomic package, and discusses a few gotchas, too.
  • map[string]interface{} in Go
    • Bitfield Consulting
    • As someone who has used a map[string]interface{} numerous times, this was a fun read. It's actually part 6 of a series on maps in general. Pretty quick read and geared more towards beginners, but still a few good takeaways including when not to use a map[string]interface{} in your programs or at least how to protect yourself when using one.
  • Using Go Generics
    • Scott White
    • Generics continue to be a fairly hot topic within the Go community. In this post, Scott goes through an example where he utilizes generics, and shows the difference in code for when using generics vs. when not. The primary argument for using generics is that it allows for more usable code (and less copying) but the argument against is that this then hurts readability and can make the code more complex. This is a nice post that isn't too lengthy and fairly straightforward and provides interesting commentary on the pro's vs. the con's.
  • A Guide to Interfaces in Go
    • fast4ward
    • Ahhh, interfaces! When learning Go from Ruby, this was one of the hardest concepts for me to grasp. They still kind of can be tricky. This is a lengthy post but it is approachable even for beginners. I'll be bookmarking it for sure. The post starts by defining polymorphism and how interfaces enable this -- we can ignore what type a variable has, but instead focus on what we can do with it. It starts with a simple example, and then moves into more specifics, including the difference between implicit and structurally typed, what the heck an empty interface is and why you'd use one, the nil interface and how to be safe when using interfaces, plus plenty more.
  • Go is pass-by-value, but it might not always feel like it
    • Neil Alexander
    • This was another concept that took me awhile to wrap my head around, and it's never a bad idea to take time to re-enforce a key tenet of the language like this. To pass by value means that when you give a value as a param to a function, the received value in the function is a copy of the original. Easy enough, right? Well, as this article points out, this can become confusing for example when you pass a map into a function, modify it within the function, and find that it gets modified everywhere. This article goes through the various data types (slices, maps, channels and structs) and explains how the notion of pass by value works for each. Spoiler alert as it relates to the map example. The map reference is what is being passed by value, not the contents of the map. P.S., if you want to read about how to use pointers, which allow you to share the variable, check out this article.

Honeybadger has your back when it counts. We're the only error tracker that combines exception monitoring, uptime monitoring, and cron monitoring into a single, simple to use platform.

Our mission: to tame production and make you a better, more productive developer. Learn more

“We’ve looked at a lot of error management systems. Honeybadger is head and shoulders above the rest and somehow gets better with every new release.”
Michael Smith
Try Error Monitoring Free for 15 Days
Are you using Bugsnag, Rollbar, or Airbrake for your monitoring? Honeybadger includes exception, uptime, and check-in monitoring — all for probably less than you’re paying now. Discover why so many companies are switching to Honeybadger here.
Try Error Monitoring Free for 15 Days