frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Convert tempo (BPM) to millisecond durations for musical note subdivisions

https://brylie.music/apps/bpm-calculator/
1•brylie•2m ago•0 comments

Show HN: Tasty A.F.

https://tastyaf.recipes/about
1•adammfrank•2m ago•0 comments

The Contagious Taste of Cancer

https://www.historytoday.com/archive/history-matters/contagious-taste-cancer
1•Thevet•4m ago•0 comments

U.S. Jobs Disappear at Fastest January Pace Since Great Recession

https://www.forbes.com/sites/mikestunson/2026/02/05/us-jobs-disappear-at-fastest-january-pace-sin...
1•alephnerd•4m ago•0 comments

Bithumb mistakenly hands out $195M in Bitcoin to users in 'Random Box' giveaway

https://koreajoongangdaily.joins.com/news/2026-02-07/business/finance/Crypto-exchange-Bithumb-mis...
1•giuliomagnifico•4m ago•0 comments

Beyond Agentic Coding

https://haskellforall.com/2026/02/beyond-agentic-coding
2•todsacerdoti•5m ago•0 comments

OpenClaw ClawHub Broken Windows Theory – If basic sorting isn't working what is?

https://www.loom.com/embed/e26a750c0c754312b032e2290630853d
1•kaicianflone•7m ago•0 comments

OpenBSD Copyright Policy

https://www.openbsd.org/policy.html
1•Panino•8m ago•0 comments

OpenClaw Creator: Why 80% of Apps Will Disappear

https://www.youtube.com/watch?v=4uzGDAoNOZc
1•schwentkerr•12m ago•0 comments

What Happens When Technical Debt Vanishes?

https://ieeexplore.ieee.org/document/11316905
1•blenderob•13m ago•0 comments

AI Is Finally Eating Software's Total Market: Here's What's Next

https://vinvashishta.substack.com/p/ai-is-finally-eating-softwares-total
2•gmays•14m ago•0 comments

Computer Science from the Bottom Up

https://www.bottomupcs.com/
2•gurjeet•14m ago•0 comments

Show HN: A toy compiler I built in high school (runs in browser)

https://vire-lang.web.app
1•xeouz•16m ago•0 comments

You don't need Mac mini to run OpenClaw

https://runclaw.sh
1•rutagandasalim•17m ago•0 comments

Learning to Reason in 13 Parameters

https://arxiv.org/abs/2602.04118
1•nicholascarolan•19m ago•0 comments

Convergent Discovery of Critical Phenomena Mathematics Across Disciplines

https://arxiv.org/abs/2601.22389
1•energyscholar•19m ago•1 comments

Ask HN: Will GPU and RAM prices ever go down?

1•alentred•19m ago•0 comments

From hunger to luxury: The story behind the most expensive rice (2025)

https://www.cnn.com/travel/japan-expensive-rice-kinmemai-premium-intl-hnk-dst
2•mooreds•20m ago•0 comments

Substack makes money from hosting Nazi newsletters

https://www.theguardian.com/media/2026/feb/07/revealed-how-substack-makes-money-from-hosting-nazi...
5•mindracer•21m ago•0 comments

A New Crypto Winter Is Here and Even the Biggest Bulls Aren't Certain Why

https://www.wsj.com/finance/currencies/a-new-crypto-winter-is-here-and-even-the-biggest-bulls-are...
1•thm•21m ago•0 comments

Moltbook was peak AI theater

https://www.technologyreview.com/2026/02/06/1132448/moltbook-was-peak-ai-theater/
1•Brajeshwar•22m ago•0 comments

Why Claude Cowork is a math problem Indian IT can't solve

https://restofworld.org/2026/indian-it-ai-stock-crash-claude-cowork/
2•Brajeshwar•22m ago•0 comments

Show HN: Built an space travel calculator with vanilla JavaScript v2

https://www.cosmicodometer.space/
2•captainnemo729•22m ago•0 comments

Why a 175-Year-Old Glassmaker Is Suddenly an AI Superstar

https://www.wsj.com/tech/corning-fiber-optics-ai-e045ba3b
1•Brajeshwar•22m ago•0 comments

Micro-Front Ends in 2026: Architecture Win or Enterprise Tax?

https://iocombats.com/blogs/micro-frontends-in-2026
2•ghazikhan205•25m ago•1 comments

These White-Collar Workers Actually Made the Switch to a Trade

https://www.wsj.com/lifestyle/careers/white-collar-mid-career-trades-caca4b5f
1•impish9208•25m ago•1 comments

The Wonder Drug That's Plaguing Sports

https://www.nytimes.com/2026/02/02/us/ostarine-olympics-doping.html
1•mooreds•25m ago•0 comments

Show HN: Which chef knife steels are good? Data from 540 Reddit tread

https://new.knife.day/blog/reddit-steel-sentiment-analysis
1•p-s-v•26m ago•0 comments

Federated Credential Management (FedCM)

https://ciamweekly.substack.com/p/federated-credential-management-fedcm
1•mooreds•26m ago•0 comments

Token-to-Credit Conversion: Avoiding Floating-Point Errors in AI Billing Systems

https://app.writtte.com/read/kZ8Kj6R
1•lasgawe•26m ago•1 comments
Open in hackernews

Waitgroups: What they are, how to use them and what changed with Go 1.25

https://mfbmina.dev/en/posts/waitgroups/
62•mfbmina•5mo ago

Comments

nikolayasdf123•5mo ago
> wg := sync.WaitGroup{}

just `var wg sync.WaitGroup`, it is cleaner this way

mr90210•5mo ago
Oh you are one of those. The nit picker. This is not at a PR review mate.
nikolayasdf123•5mo ago
"one of those", name calling, telling me what to say,

cool it down a little. touch some grass. and hopefully you will see beauty in Go zero-values :P

dwb•5mo ago
Why?
nikolayasdf123•5mo ago
zero value. container-agnostic initialization. say your type is not struct anymore, you would not have to change the way you intialize it. what you care here is zero value, and let the type figure out that it is zero and use methods appropriately. and it is just more clean this way

here is google guideline: https://google.github.io/styleguide/go/best-practices#declar...

dwb•5mo ago
That is a much better argument than saying it is "more clean", which doesn't mean anything. I don't necessarily agree, because I don't think zero values are a good feature of the language, and even if they were this is a completely trivial case. But at least I don't have to work out what "cleanliness" is.
fozdenn•5mo ago
doesn't this point to a bigger problem that there are two ways of doing the same thing?
nikolayasdf123•5mo ago
no. it is different thing. container-agnostic zero value vs struct init.
unsnap_biceps•5mo ago
multiple ways of doing something isn't inherently bad.

For example, if you want to set a variable to the number of seconds in seven hours, you could just set the variable to 25200, or you could set it to 60 * 60 * 7. The expanded version might be clearer in the code context, but in the end they do exactly the same thing.

pests•5mo ago
Your math equation turned the asterisks into italics.
unsnap_biceps•5mo ago
Whoops, fixed. Thanks for the note
nikolayasdf123•5mo ago
hold on, why would you have 7 hours?

dont you mean a week? 60 x 60 x 24 x 7 ?

or at lest 8 hours?

7 hours is just odd

unsnap_biceps•5mo ago
The goal was to pick an arbitrary number that wasn't well known. There was no intention behind the specific value chosen.
stefanos82•5mo ago
Personally I wished they had it backported to previous versions too, because it's rather convenient!

What is quite sad is that we cannot add it ourselves as it's so simple of what they have done:

    func (wg *WaitGroup) Go(f func()) {
        wg.Add(1)
        go func() {
            defer wg.Done()
           f()
        }()
    }
cedws•5mo ago
You can wrap WaitGroup if you really want to.
stefanos82•5mo ago
Can you provide an example please?
listeria•5mo ago
something like this would do it:

  package main
  
  import (
    "sync"
    "time"
  )
  
  type WaitGroup struct {
    sync.WaitGroup
  }
  
  func (wg *WaitGroup) Go(fn func()) {
    wg.Add(1)
    go func() {
      defer wg.Done()
      fn()
    }()
  }
  
  func main() {
    var wg WaitGroup
    wg.Go(func() { time.Sleep(1 * time.Second) })
    wg.Wait()
  }
stefanos82•5mo ago
This is really amazing, thank you so much!
listeria•5mo ago
It's called struct embedding, there an article about it in Go by Example if you're interested: https://gobyexample.com/struct-embedding
stefanos82•5mo ago
Thank you @listeria, today I learned about struct embedding lol!
genghisjahn•5mo ago
I rediscover this about once a year and am always so happy when I do.
evanelias•5mo ago
You can just use golang.org/x/sync/errgroup instead, which has always provided this style of use.

errgroup also has other niceties like error propagation, context cancellation, and concurrency limiting.

porridgeraisin•5mo ago
errgroup cancels the whole task if even one subtask fails however. That is not desirable always.
Groxx•5mo ago
It does not, which is easy to verify from the source. Every func passed in is always run (with the exception of TryGo which is explicitly "maybe").

At best, using the optional, higher-effort errgroup.WithContext will cancel the context but still run all of your funcs. If you don't want that for one of the funcs, or some component of them, just don't use the context.

evanelias•5mo ago
If the context cancellation is undesirable, you just choose not to use WithContext, as the sibling comment mentions.

You could also just make your subtask function return nil always, if you just want to get the automatic bookkeeping call pattern (like WaitGroup.Go from Golang 1.25), plus optional concurrency limiting.

Also note, even if a subtask function returns an error, the errgroup Wait blocking semantics are identical to those of a WaitGroup. Wait will return the first error when it returns, but it doesn't unblock early on first error.

Cyph0n•5mo ago
Context cancellation is not always desirable. I personally have been bitten multiple times by the default behavior of errgroup.
CamouflagedKiwi•5mo ago
You have to explicitly propagate the group's context if you want it to cancel. You can just not do that if you don't want - there certainly are cases for that.
Cyph0n•5mo ago
But if you’re looking at the package API, there is no alternative constructor for Group, which makes it seem as if the most common default is to construct a Group using WithContext. Also, 2/3 of the examples use WithContext.

My recommendation would be to have a NewGroup function or equivalent that returns an empty group to surface it as an alternative to WithContext.

evanelias•5mo ago
> My recommendation would be to have a NewGroup function or equivalent that returns an empty group

That goes against common practices in Golang, articulated in the second paragraph of https://go.dev/doc/effective_go#allocation_new among many other places.

Also the errgroup documentation specifically says "A zero Group is valid, has no limit on the number of active goroutines, and does not cancel on error." And, as you noted, one of the examples doesn't use WithContext.

Cyph0n•5mo ago
That’s one of my Go pet peeves - zero/default structs are sometimes valid and sometimes not, and the only way to know is to dig into the docs. I prefer the API to speak for itself, ideally enforced by the language/compiler.
CamouflagedKiwi•5mo ago
They basically don't backport anything for Go, but the quid pro quo for that is that the backwards compatibility is pretty strong so upgrades should be safe. I have seen one serious issue from it, but still it's the language I'm the most confident to do an upgrade and expect things to Just Work afterwards.
porridgeraisin•5mo ago
Love this. Majority of concurrency in a usual web service is implemented using waitgroups IME (see below) This will greatly simplify it.

  var wg sync.WaitGroup
  wg.Add(1)
  go func(){
    callService1(inputs, outParameter)
    wg.Done()
  }
  // Repeat for services 2 through N
  wg.Wait()
  // Combine all outputs

BTW, this can already be done with a wrapper type

  type WaitGroup struct { sync.WaitGroup }

  func (wg *WaitGroup) Go(fn func()) {
    wg.Add(1)
    go func() {
      fn()
      wg.Done()
    }()
  }
Since you're doing struct embedding you can call methods of sync.WaitGroup on the new WaitGroup type as well.
a-poor•5mo ago
This means you can't pass variables in as function arguments. Even the example in the official go docs doesn't handle the scope correctly:

  func main() {
   var wg sync.WaitGroup
   var urls = []string{
    "http://www.golang.org/",
    "http://www.google.com/",
    "http://www.example.com/",
   }
   for _, url := range urls {
    // Launch a goroutine to fetch the URL.
    wg.Go(func() {
     // Fetch the URL.
     http.Get(url)
    })
   }
   // Wait for all HTTP fetches to complete.
   wg.Wait()
  }
https://pkg.go.dev/sync#example-WaitGroup

You need to use this pattern instead:

   for _, url := range urls {
    url := url
    // ...
jeremyloy_wt•5mo ago
This isn’t necessary anymore as of Go 1.22

https://go.dev/blog/loopvar-preview

9rx•5mo ago
> This means you can't pass variables in as function arguments.

Well, you could...

    for _, url := range urls {
        wg.Go(func(u string) func() {
            return func() {
                http.Get(u)
            }
        }(url))
    }
> You need to use this pattern instead

Why? Seems rather redundant. It is not like WaitGroup.Go exists in earlier versions.

danenania•5mo ago
I like WaitGroup as a concept, but I often end up using a channel instead for clearer error handling. Something like:

  errCh := make(chan error)
  for _, url := range urls {
    go func(url string){
      errCh <- http.Get(url)
    }(url)
  }

  for range urls {
    err := <-errCh
    if err != nil {
      // handle error
    }
  }
Should I be using WaitGroup instead? If I do, don't I still need an error channel anyway—in which case it feels redundant? Or am I thinking about this wrong? I rarely encounter concurrency situations that the above pattern doesn't seem sufficient for.
javier2•5mo ago
How you handle err here? If you return, the go routines will leak
danenania•5mo ago
Ah, good point—should be using a buffered channel to avoid that:

  errCh := make(chan error, len(urls))
unsnap_biceps•5mo ago
buffered channels won't help here. That's just how many results can be buffered before the remaining results can be added to the channel. It doesn't wait until all of them are done before returning a result to the consumer.
danenania•5mo ago
> It doesn't wait until all of them are done before returning a result to the consumer.

Right, but it prevents goroutine leaks. In these situations I'm usually fine with bailing on the first error, but I grant that's not always desirable. If it's not, I would collect and join errors and return those along with partial results (if those are useful).

c0balt•5mo ago
You would probably benefit from errgroup, https://pkg.go.dev/golang.org/x/sync/errgroup

But channels already do the waiting part for you.

danenania•5mo ago
Thanks! looking into errgroup
tombert•5mo ago
Forgive a bit of ignorance, it's been a bit since I've touched Go, but this looks awfully similar to a Java CountdownLatch [1]. Is this just a glorified Go port of that or am I missing something vital here?

[1] https://docs.oracle.com/javase/8/docs/api/java/util/concurre...

xh-dude•5mo ago
Pretty much. It’s a counting semaphore underneath.
arccy•5mo ago
CountDownLatch looks like it can only count down? the go one you can add/remove at will
layer8•5mo ago
Phaser [0] would be the more flexible equivalent in Java.

[0] https://docs.oracle.com/javase/7/docs/api/java/util/concurre...

tombert•5mo ago
You are right; it looks like a Phaser is a bit more analogous: https://docs.oracle.com/javase/8/docs/api/java/util/concurre...