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.
What to do next:
  1. Try Honeybadger for FREE
    Honeybadger helps you find and fix errors before your users can even report them. Get set up in minutes and check monitoring off your to-do list.
    Start free trial
    Easy 5-minute setup — No credit card required
  2. Get the Honeybadger newsletter
    Each month we share news, best practices, and stories from the DevOps & monitoring community—exclusively for developers like you.
    Stop wasting time manually checking logs for errors!

    Try the only application health monitoring tool that allows you to track application errors, uptime, and cron jobs in one simple platform.

    • Know when critical errors occur, and which customers are affected.
    • Respond instantly when your systems go down.
    • Improve the health of your systems over time.
    • Fix problems before your customers can report them!

    As developers ourselves, we hated wasting time tracking down errors—so we built the system we always wanted.

    Honeybadger tracks everything you need and nothing you don't, creating one simple solution to keep your application running and error free so you can do what you do best—release new code. Try it free and see for yourself.

    Start free trial
    Simple 5-minute setup — No credit card required

    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, Cofounder & CTO of YvesBlue

    Honeybadger is trusted by top companies like:

    “Everyone is in love with Honeybadger ... the UI is spot on.”
    Molly Struve, Sr. Site Reliability Engineer, Netflix
    Start free trial