frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Mexico to US Livestock Trade halted due to Screwworm spread

https://www.usda.gov/about-usda/news/press-releases/2025/07/09/secretary-rollins-takes-decisive-action-and-shuts-down-us-southern-border-ports-livestock-trade-due
188•burnt-resistor•3h ago•144 comments

Show HN: The current sky at your approximate location, as a CSS gradient

https://sky.dlazaro.ca
259•dlazaro•4h ago•53 comments

Long-term exposure to outdoor air pollution linked to increased risk of dementia

https://www.cam.ac.uk/research/news/long-term-exposure-to-outdoor-air-pollution-linked-to-increased-risk-of-dementia
120•hhs•4h ago•32 comments

OpenFreeMap survived 100k requests per second

https://blog.hyperknot.com/p/openfreemap-survived-100000-requests
198•hyperknot•4h ago•55 comments

Simon Willison's Lethal Trifecta Talk at the Bay Area AI Security Meetup

https://simonwillison.net/2025/Aug/9/bay-area-ai/
73•vismit2000•3h ago•19 comments

Empire of the Absurd: A Brief History of the Absurdities of the Soviet Union

https://laurivahtre.ee/empire-of-the-absurd/
41•Maro•2h ago•26 comments

Quickshell – building blocks for your desktop

https://quickshell.org/
142•abhinavk•4d ago•23 comments

A CT scanner reveals surprises inside the 386 processor's ceramic package

https://www.righto.com/2025/08/intel-386-package-ct-scan.html
19•robin_reala•37m ago•2 comments

ChatGPT Agent – EU Launch

https://help.openai.com/en/articles/11752874-chatgpt-agent
32•Topfi•2h ago•8 comments

MCP's Disregard for 40 Years of RPC Best Practices

https://julsimon.medium.com/why-mcps-disregard-for-40-years-of-rpc-best-practices-will-burn-enterprises-8ef85ce5bc9b
38•yodon•3h ago•8 comments

Don Knuth on ChatGPT(07 April 2023)

https://cs.stanford.edu/~knuth/chatGPT20.txt
9•b-man•41m ago•1 comments

ESP32 Bus Pirate 0.5 – A Hardware Hacking Tool That Speaks Every Protocol

https://github.com/geo-tp/ESP32-Bus-Pirate
30•geo-tp•2h ago•2 comments

Accessibility and the Agentic Web

https://tetralogical.com/blog/2025/08/08/accessibility-and-the-agentic-web/
6•edent•1h ago•3 comments

Cordoomceps – replacing an Amiga's brain with Doom

https://mjg59.dreamwidth.org/73001.html
19•naves•3d ago•3 comments

Testing Bitchat at the music festival

https://primal.net/saunter/testing-bitchat-at-the-music-festival
13•alexcos•3d ago•6 comments

Jan – Ollama alternative with local UI

https://github.com/menloresearch/jan
110•maxloh•8h ago•58 comments

End-User Programmable AI

https://queue.acm.org/detail.cfm?id=3746223
11•tosh•2h ago•0 comments

The dead need right to delete their data so they can't be AI-ified, lawyer says

https://www.theregister.com/2025/08/09/dead_need_ai_data_delete_right/
112•rntn•4h ago•69 comments

Ratfactor's Illustrated Guide to Folding Fitted Sheets

https://ratfactor.com/cards/fitted-sheets
59•zdw•5h ago•9 comments

I want everything local – Building my offline AI workspace

https://instavm.io/blog/building-my-offline-ai-workspace
953•mkagenius•23h ago•257 comments

Car has more than 1.2M km on it – and it's still going strong

https://www.cbc.ca/news/canada/nova-scotia/1985-toyota-tercel-high-mileage-1.7597168
143•Sgt_Apone•3d ago•188 comments

Sandstorm- self-hostable web productivity suite

https://sandstorm.org/
127•nalinidash•11h ago•26 comments

The current state of LLM-driven development

http://blog.tolki.dev/posts/2025/08-07-llms/
4•Signez•1h ago•0 comments

Partially Matching Zig Enums

https://matklad.github.io/2025/08/08/partially-matching-zig-enums.html
128•ingve•9h ago•83 comments

Tribblix – The Retro Illumos Distribution

http://www.tribblix.org/
83•bilegeek•11h ago•23 comments

Breaking the Sorting Barrier for Directed Single-Source Shortest Paths

https://arxiv.org/abs/2504.17033
85•pentestercrab•12h ago•3 comments

A SPARC makes a little fire

https://www.leadedsolder.com/2025/08/05/sparcstation-scsi-termination-fix-magic-smoke.html
83•zdw•4d ago•12 comments

60% of medal of honor recipients are Irish or Irish-American

https://en.wikipedia.org/wiki/List_of_Irish-American_Medal_of_Honor_recipients
62•physarum_salad•2h ago•29 comments

Why Wisconsin's county highways are lettered, not numbered (2019)

https://www.wpr.org/transportation/why-wisconsins-county-roads-are-lettered-not-numbered
32•kaladin-jasnah•3d ago•27 comments

Ask HN: What Toolchains Are People Using for Desktop App Development in 2025?

6•lincoln20xx•1h ago•2 comments
Open in hackernews

A subtle bug with Go's errgroup

https://gaultier.github.io/blog/subtle_bug_with_go_errgroup.html
18•broken_broken_•5h ago

Comments

nasretdinov•3h ago
So it's really the issue due a partial variable shadowing during assignment, not errgroup-specific. Got bitten by it multiple times unfortunately, but I don't think there's an easy lint or vet check that could prevent such errors from happening. Having said that, overwriting a variable during := assignment is typically only useful for errors, so potentially you might want to have a lint check that complains when you've overwritten something else. There's already a check that the value is unused so when re-assigning the error value you're less likely to miss anything
yubblegum•2h ago
> So it's really the issue due a partial variable shadowing during assignment, not errgroup-specific.

Did we read the same article? The "alternative fix" is to paper over documented bahavior of a context. Of course it makes sense that if wait returns context should be canceled. The one character fix is throwing away information ..

masklinn•1h ago
> The one character fix is throwing away information ..

It's duplicate information, since Wait essentially provides the same thing (and in fact the context returned is mostly to solely for the callbacks to use, if the callbacks don't need it, it should be thrown away).

dondraper36•2h ago
That's why I often use eg, egCtx :)
eddythompson80•2h ago
No? Its about errgroup ctx being automatically cancelled once the group is done (in success or err). It kinda makes sense, and its documented. I understand how it can be surprising, but if you think about it for a second, it makes sense. The context created is meant to manage the lifecycle of the errgroup. Once the group is done, the ctx is done.
nasretdinov•57m ago
It's only about context _returned by errgroup_ being cancelled, you shouldn't be overwriting it in the way in which it was used by an article, which is really hard to spot due to variable shadowing.
masklinn•37m ago
> variable shadowing

There is no shadowing.

It's also harder to spot that this is a bad pattern because it's exactly what the package examples currently do.

dantillberg•2h ago
I'd say it's fair to call this a footgun, though not a bug. The context is really only intended to apply to the goroutines. And Wait has to cancel the context to prevent a resource leak.

I suggest in general using function scoping to drive the lifetime of contexts, etc. This works also for defers and tracing spans in addition to the canonically shadowed `ctx` variable.

There is an old issue in the tracker proposing changes to alleviate this: https://github.com/golang/go/issues/34510. The original author (bcmills) of the errgroup package shared insight into the design choices/tradeoffs he made.

masklinn•2h ago
> Shadowing is another concept that made this issue less visible.

There is no shadowing here, Go can only shadow in different scopes, `ctx` is just rebound (overwritten). Zig does not prevent reusing variables that I know. However I believe zig parameters are implicitly `const`, which would have prevented thoughtlessly updating the local in-place. Same in Rust.

> If you've ever heard of linear types, and never saw their utility, that's actually exactly what they are good for: a variable gets 'consumed' by a function, and the type system prevents us from using it after that point. Conceptually, g.Wait(ctx) consumes ctx and there is no point using this ctx afterwards.

I don't believe linear types would prevent this issue per-se since `errgroup.WithContext` specifically creates a derived context.

Depending on the affordance they might make the issue clearer but they also might not: a linear errgroup.WithContext could consume its input leaving you only with the sub-context and thinking little more of it, so you'd have to think to create derived context on the caller side. Would you think of this issue when doing that?

TBH this seems more of a design issue in errgroup's API: why is the context returned from the errgroup instead of being an attribute? That would limit namespace pollution and would make the relationship (and possible effects) much clearer. But I don't know what drove the API to be designed as it is.

But in all honesty I'd say the main error in the snippet is that `checkHaveIBeenPawned` swallows all http client errors, without even logging them. That is the part which struck out to me, it only returns an error if it positively finds that the password was a hit on HIBP. So you'd have hit the exact same issue if the `NewRequestWithContext` was otherwise malformed e.g. typo in the method or URL. And of course that points out to an other issue, this time with type-erased errors and error information not necessarily being programmatically accessible or at least idiomatically checked: I would assume the goal was to avoid triggering an error if HIBP is unavailable (DNS lookup or connection error).

eddythompson80•1h ago
> why is the context returned from the errgroup instead of being an attribute?

It's a go style thing[1]. "Dont store context in a struct" is the general advice. Anybody seeing a ctx in a struct will flag the PR. I think golangci-lint does too.

The claim is that its confusing. Also you'll never see any std lib apis doing that. People just assume its a bad idea and don't do it. There are situations where it makes sense. Like operations that are described by a struct and you want to attach their context to those structs. A Boland developer will tell you "you're thinking in Java/Python/C#/JavaSctipt/etc you need to think in Go" and yes you can always rewrite the whole thing to be more go-like as in errgroup API. But it's just a style thing.

[1] https://go.dev/blog/context-and-structs

nikolayasdf123•1h ago
omg. you are right. found multiple bugs just now thanks to this... they sould really improve this API of waitgroup/errgroup
vultour•1h ago
This seems like a terrible misunderstanding of the errgroup package? The entire point of the returned context is that it's cancelled if an error occurs, yet the author never uses it again until after he's done with the errgroup. The behaviour is also clearly documented in the only function exported by the package.
masklinn•1h ago
> The entire point of the returned context is that it's cancelled if an error occurs, yet the author never uses it again until after he's done with the errgroup.

`Wait()` also does that. And the examples in the package documentation don't show the context as a way for the caller to be notified that things are done (that's what `Wait()` is for) but as a way for the callees (the callbacks passed to Do) to early abort.

This is mostly confirmed by the discussion dantillberg linked above, where someone suggests passing the errgroup's context down to the callbacks as parameter and the package author replies they don't do that because the lack of inference makes for nasty boilerplate (https://github.com/golang/go/issues/34510#issuecomment-53961...).

tonyhb•1h ago
Yeah, just... like, don't use ctx from WithContext after the errgroup. WithContext is an API that specifically and explicitly cancels the context on error. It's absolutely optional. It's not a bug at all. It's using the wrong APIs and using a variable out of intended scope.
nickcw•1h ago
I love errgroup, though I always use it like this

    g, gCtx := errgroup.WithContext(ctx)
And then use gCtx in the g.Go function calls.

That would have avoided the problem.

Perhaps worth a submission to https://staticcheck.dev/ ?