4,615 karma · joined October 20, 2010
https://github.com/peterldowns
https://twitter.com/peterldowns
Always happy to meet a stranger, please reach out any time: hn @ peterdowns.com
[ my public key: https://keybase.io/peterldowns; my proof: https://keybase.io/peterldowns/sigs/9N-85LOZH1eJMXHLR70WroivxJB1is_s3ye5IT5xzxs ]
Beyond that, this a too-long essay about a deeply poisonous and discouraging worldview. I regret having read it. At least it wasn't written by AI!
2) TIL about `T.Output`, thank you, that's great to know about. Still annoying and would be nice if the slog package showed an example of logging from tests with correct callsites. Golang gets so many things right about testing, so the fact that logging in tests is difficult really stands out and bothers me.
For an example from one of my own libraries, see
https://github.com/peterldowns/pgmigrate/blob/d3ecf8e4e8af87...
1) If you're writing a library that can be used by many different applications and want to emit logs, you'll still need to write a generic log interface with adapters for slog, zap, charmlog, etc. That the golang team refuses to bless a single interface for everyone to settle on both makes sense given their ideological standpoint on shipping interfaces and also causes endless mild annoyance and code duplication.
2) I believe it's still impossible to see the correct callsite in test logs when using slog as the logger. For more information, see https://github.com/neilotoole/slogt?tab=readme-ov-file#defic.... It's possible I'm out of date here — please correct me if this is wrong, it's actually a much larger annoyance for me and one of the reasons I still use uber/zap or charmbracelet/log.
Overall, especially given that it performs worse than uber/zap and everyone has basically standardized on that and it provides essentially the same interface, I recommend using uber/zap instead.
EDIT: just to expand further, take a look at the recommended method of wrapping helper methods that call logs. Compare to the `t.Helper()` approach. And some previous discussion. Frustrating!
- https://pkg.go.dev/log/slog#example-package-Wrapping
- https://github.com/golang/go/issues/59145#issuecomment-14770...
In terms of achieving the overall goal of "greening" the web, I would be very interested to see even some back-of-the-envelope math explaining how much energy this technique saves and how much of an impact that would have. Understanding the energy cost of webpages and massive edge rewriting serverless platforms like Cloudflare is unintuitive to me.
Cynically, my impression is that the overall approach is more like "greenwashing" than "greening" — at best I would guess it "raises awareness", with all of the implications to efficacy that such actions usually have. I followed the links through from the blog to The Green Web Foundation's FAQ [0] and did not find any tangible estimates of energy impact nor any attempts at measuring such an impact. The success metrics [1] they list do not include any measure of energy saved or understanding of the potential to save energy; rather, basically just attention.
[0] https://www.thegreenwebfoundation.org/tools/grid-aware-websi...
[1] https://www.thegreenwebfoundation.org/tools/grid-aware-websi...
https://freezine.xyz/2/my-boys-got-his-own-ring-tone/index.h...
Uncaught TypeError: a.frequency.cancelAndHoldAtTime is not a function
Pretty fun in Chrome!
https://en.wikipedia.org/wiki/Strongly_typed_identifier
> The strongly typed identifier commonly wraps the data type used as the primary key in the database, such as a string, an integer or universally unique identifier (UUID).
https://lukasschwab.me/blog/gen/deriving-safe-id-types-in-go...
> The thing is, I'm not actually sure if Guix's better documentation helps smooth the onboarding in any way because you have to already know Scheme, which is a more complex language than Nix.
LMAO absolutely not. Nix-the-language is the worst programming language I've ever had the misfortune to interact with. I picked up Scheme in about 1 day during a class in college. It's night-and-day different.
Two short articles I was basing this off of:
- "When somebody loses weight, where does the fat go?" https://www.bmj.com/content/349/bmj.g7257
- "Sleep and Metabolism: An Overview" https://pmc.ncbi.nlm.nih.gov/articles/PMC2929498/
edit: see my followup comment, didn't mean to mislead here. I'm not a scientist and sleep and food science is both pretty hard to trust.
My favorite line in this article:
> I’ve come to see overtourism as a kind of natural disaster. How can you get angry at the earth for having an earthquake?