Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K

    Dave Cheney

    dave.cheney.net · Personal blog · on HN since 2012

    Dave Cheney, a Go programmer and conference speaker, writes about Go language design, error handling, cgo, and API patterns.

    Visit blogRSSHN submissions
    Languages & CompilersProgrammingSystems & Performance
    What HN says

    HN commenters cite his posts as references, especially "Cgo is not Go" on cgo's costs and "Channel Axioms" on Go concurrency behavior.

    Stats for nerds
    271HN people shared it
    233linked in comments
    9.4Kstory points
    Jul 2025last shared
    2013people per year2025

    Top posts on HN

    1. 1
      Why Slack is inappropriate for open source communications
      1 person · 847 points · first shared 2017 · 521 comments on HN
    2. 2
      Practical Go: Real-world advice for writing maintainable Go programs
      3 people · 689 points · first shared 2019 · 226 comments on HN
    3. 3
      Clear is better than clever [pdf]
      1 person · 498 points · first shared 2019 · 318 comments on HN
    4. 4
      Clear is better than clever
      1 person · 365 points · first shared 2019 · 186 comments on HN
    5. 5
      The Zen of Go
      1 person · 328 points · first shared 2020 · 333 comments on HN
    6. 6
      Go 1.7 toolchain improvements
      5 people · 248 points · first shared 2016 · 98 comments on HN
    7. 7
      The ‘here is’ key
      4 people · 243 points · first shared 2017 · 54 comments on HN
    8. 8
      Taking Go modules for a spin
      3 people · 233 points · first shared 2018 · 71 comments on HN
    9. 9
      Go’s hidden pragmas
      3 people · 221 points · first shared 2018 · 115 comments on HN
    10. 10
      Be wary of functions which take several parameters of the same type
      2 people · 220 points · first shared 2019 · 234 comments on HN

    What HN people wrote when they linked it

    • matttproudNov 2024

      My opinion on Kubernetes as a yardstick example of Go is this:

      This was one of the first large systems developed in Go, not too long after the language hit version 1.0 (ca. 12 years ago). What constituted good Go style and package architecture were not well known at that time even. Given that and hindsight being 20:20, I could easily imagine the internal architecture (not even the public surface) for Kubernetes being a lot different and simpler. The package architecture alone makes me cringe. As a hypothetical counterpoint, I wonder what Kubernetes would have looked like had Dave Cheney (https://dave.cheney.net/) and Rob Pike built it in that era. I think that would have been a better yard stick.

      I have a unique appreciation for this first large systems perspective as I co-designed an adjacent product in the cloud native ecosystem at that time (Prometheus). There was no good example to follow when it came to large program structure and design in Go at that time. We were all figuring that out for ourselves — organically.

      I think this point about organic evolution of the architecture is important to call out explicitly, because developers often look at an existing structure and essentially mimic it with their additions, changes, and refactors irrespective of whether the structure was correct for the problem it was trying to solve or even good. Given that reality, is it really any wonder that one of the first major pieces of software ended up being this metaphorical…

    • fizzbatterNov 2016

      So, i was a Go developer for ~4 years, then for the last 4 months or so i've been learning and using Rust. The pure joy of some things with Rust was astounding.

      Now, i joined a new job and they're in need of a new language for some backend tasks - the choice was mine. Rust or Go? The backend tasks were heavy API servers - nothing amazing, we don't do groundbreaking work. Python was their existing language, but they weren't too happy with it.

      For weeks (literally) i mulled it over, i really really really wanted to use Rust. Rust gives me a peace of mind that Go never came close to. Unfortunately, Rust does not fit the development speed nor developer experience[1] that this shop has.. and i really felt Go would be the best choice for this place.

      My point to this post isn't to make a Rust vs Go comparison.. but rather, a wishlist for the hopefully eventual Go 2.0. I have no idea if/when that will ever be made.. but i hope it will, and i hope they adopt some things from Rust.

      1. Channels without panics. Channels are awesome, but Go's design of them means that you have to learn special ways to design your usage of channels so that it does not crash your program. This is asinine to me. So much type safety exists in Go, and yet it's so easy for a developer to trip over channels and crash their program.

      2. Proper error handling. I love error checking - i love it in Rust especially. It's very explicit, and most importantly, very easy to check the type of things. Recently i was…

    • unscaledJun 2023

      I'm pretty sure the designers of Rust knows about CSP. Rust has Channels in the standard library after all:
      https://doc.rust-lang.org/rust-by-example/std_misc/channels.html

      Rust Channel have the nice additional that they don't panic, and don't have all the weird Go Channel Axioms[1] that you have to wrap your head around to get things to work correctly[2].

      For what it's worth, I don't think Java Virtual Threads (a.k.a. project loom) has implemented an explicit concept of channels, although I guess BlockingQueue could work as a channel.

      There is a big issue with bringing CSP to languages like Java 21 or Go, that use so-called "colorless concurrency" or "stackful coroutines". CSP losses a lot of its modeling power when you combin shared mutable state and pre-emptive (or invisible) parallelism. And this is exactly what both of these languages do.

      "Colored" abstractions like async/await are more cumbersome (especially in Rust), but they let you know exactly at which points of execution your stackless coroutine may suspend, and you can handle synchronization accordingly.

      Those functional concepts are cumbersome, but threads ("green", "kernel", "virtual", "goroutines" or otherwise) are not the panacea their proponents claim them to be. I had to debug way too many data races in my life to consider them perfect. Rust still has a lot to improve on its async front (no async traits, async closures or async iterators and the async runtime confusion), it can at least promise me…

    • rollulusDec 2024

      This approach is so bad, I don't even know where to start. But it's all symptoms of their, sorry, incompetence. Take the loadCredentials example on top. If os.ReadFile cannot find the file, it returns an error with string representation: "open cred.json: no such file or directory". This comes straight from the std lib as it is, a great error. What does the errors.Is(err, os.ErrNotExist) do: prepend "file not found" to it, rendering: "file not found: open cred.json: no such file or directory". So this adds exactly nothing. The next if will prepend "failed to read file" to it, again, adding nothing as well. The two errors checks should be replaced by one if statement, optionally wrapping it with a context string but I cannot think of any use. Then the next step, error handling of verifyCredentials. I can only guess what it does, but assume that it returns an "username 'foo bar' cannot contain spaces" error. Does prepending "invalid credentials" help anything? Nope, so the whole if can be removed as well. No surprise your errors get clunky if you make them clunky.

      I have more pressing things to do than dissect this article line by line, but let me suffice that I feel sorry for newcomers to the language that an article like this is so high on HN. Back in the days there was just Dave Cheney's material to read [1], and it was excellent. It's unfortunately outdated in certain regards (e.g. with new Is/As functionality in the errors package for inspection and the %w formatting…

    • beneschSep 2019

      What I would give for the developers of the Go toolchain to have spent the last decade improving GCC or LLVM instead of their own bespoke toolchain.

      In many ways Go seems like an excuse for Google to fund the continued development of Plan 9. Three of the five most influential people on the Go team (Ken Thompson, Rob Pike, and Russ Cox) were heavily involved in Plan 9. And it shows. Go's toolchain is a direct descendant of the Plan 9 toolchain; in fact, the Go language is really just an evolution of the special C dialect that Plan 9 used [1]. Indeed, for a while, the Go compiler was written in this special dialect of C, and so building Go required building a C compiler (!) that could compile this custom dialect of C, and using that to compile the Go compiler [2].

      By all rights, Plan 9 was an interesting research project, and seems well loved by those familiar with it. (I'm not personally familiar; it was well before my time.) But it never took off. What we ended up with is Linux, macOS, and Windows.

      Go very much wants to be Plan 9. Sure, it's not a full-fledged operating system. But it's a linker, assembler, compiler, binutils, and scheduler. All it asks of the host system is memory management, networking, and filesystem support, and it will happily replace your system's DNS resolution with a pure Go version if you ask it to [3]. I wouldn't be surprised if Go ships its own TCP/IP stack someday [4].

      This is, in my opinion, craziness. What other language ships its own…

    • kasey_junkMar 2016

      > What‽ It provides channels, which are a really nice abstraction for concurrency.

      Channels are a concurrent safe queue, nothing more. They are not even particularly well implemented concurrent queues as they are highly contended.

      What go provides for abstractions around those queues are range and select. Range is a nice way to make simple concurrency cases look like traditional for loops (and is very rarely used in practice as simple concurrency cases are rare, at least for me).

      Select is a nice addition to the language, yet the edge cases around channels make it very difficult to reason about without keeping http://dave.cheney.net/2013/04/30/curious-channels open.

      > Have you actually written any Go? Using channels in Go is much nicer than using callbacks.

      I have, for 2 years, full time. I have not used node. Have you ever used a language that supports concurrency besides Go? Go does not provide, as part of its concurrency abstractions, things that are deemed bare necessities by other languages such as timeouts, cancellation, supervision, lock free structures, etc.

      The entirety of the Golang concurrency story can be wrapped up with 3 things a) the culture of the language prefers message passing concurrency b) the scheduler is a very good example of when simplicity gets you great performance in the main cases c) select as a language keyword is interesting.

      By leaving the basics out you push all of that work to the application level, which is why I think the…

    Related

    Peter Bourgonpeter.bourgon.org38 people

    Go best practices, six years in

    Peter Bourgon
    Personal · last shared 2025
    Going Gogoinggo.net23 people

    Understanding Slices in Go

    Going Go
    Personal · last shared 2017
    Russ Coxresearch.swtch.com554 people

    Timeline of the xz open source attack

    Russ Cox
    Personal · last shared 2026
    Go Blogblog.golang.org529 people

    Go 2, here we come

    Go Blog
    Company · last shared 2026
    Rob Pikecommandcenter.blogspot.com216 people

    Go: What we got right, what we got wrong

    Rob Pike
    Personal · last shared 2026
    Jason Moironjmoiron.net36 people

    Go Performance Tales

    Jason Moiron
    Personal · last shared 2026
    Morsing's Blogmorsmachine.dk17 people

    The Go 1.1 scheduler

    Morsing's Blog
    Personal · last shared 2024
    Twitch Engineering Blogblog.twitch.tv178 people

    Go’s march to low-latency GC

    Twitch Engineering Blog
    Company · last shared 2026