[HN Gopher] Quartz: A Deterministic Time Testing Library for Go
       ___________________________________________________________________
        
       Quartz: A Deterministic Time Testing Library for Go
        
       Author : ammario
       Score  : 53 points
       Date   : 2024-07-15 18:30 UTC (4 hours ago)
        
 (HTM) web link (coder.com)
 (TXT) w3m dump (coder.com)
        
       | wizzard0 wrote:
       | Very cool! Anything similar for .net?
        
         | neonsunset wrote:
         | Comes out of box: https://devblogs.microsoft.com/dotnet/fake-
         | it-til-you-make-i...
         | 
         | This is yet another area where .NET offers a better package,
         | unfortunately Go community is too self-centered to notice
         | what's happening elsewhere.
        
           | lloydatkinson wrote:
           | I was about to comment the same - even before ITimeProvider
           | existed it was already very common to have an ITime or IDate
           | or IDateTime etc that would then be implemented as you need
           | for tests.
           | 
           | Having this now as a built-in is excellent.
        
           | kbolino wrote:
           | [deleted]
        
       | playingalong wrote:
       | It feels like every second, sorry every other time-related
       | library is called Quartz.
        
       | elchief wrote:
       | not a great name considering Quartz schedular for java...
        
         | lloydatkinson wrote:
         | Or for .NET
        
       | neild wrote:
       | Of possible interest to anyone testing concurrent Go code in
       | general and time in particular, a proposed standard library
       | package: https://go.dev/issue/67434
        
         | matttproud wrote:
         | This looks infinitely preferable.
        
           | padraicmahoney wrote:
           | What do you like better about it?
           | 
           | --- (btw: just read your blog on R -- love it)
        
       | wolfspaw wrote:
       | Nice, Golang is Awesome!
        
         | myvoiceismypass wrote:
         | Why is Golang awesome? Because in 2024 there is now a decent
         | mock clock library for testing? I thought that one of go's
         | selling points was the stdlib and tooling being great out of
         | the box?
        
       | nsguy wrote:
       | I have a fair bit of experience writing tests for concurrent code
       | that uses timers on Go. We started with an open source test
       | library ( https://pkg.go.dev/github.com/benbjohnson/clock ). It
       | had a lot of problems. This was many years ago, looks like it's
       | seen some maintenance since so maybe it's better? Then we tried
       | to fix it. Fixed all the obvious bugs but still had a lot of
       | problems using it in practice. It's not enough to just handle the
       | calls without context of who is calling them in concurrent code.
       | Then we switched to using gomock which ended up also being hard
       | to use.
       | 
       | It's quite tricky is sort of the bottom line. It's not enough to
       | just create fake time there's a lot more to it.
        
       ___________________________________________________________________
       (page generated 2024-07-15 23:00 UTC)