Re: [go-nuts] Re: Range over int

2024-02-23 Thread Amnon
So in 2012 Cyril Oblikov wrote Why isn't this code correct? var N int = ... for i := range N { doSmth(i) } In my opinion it looks much simpler than: var N int = ... for i := 0; i < N; i++ { doSmth(i) } So we should say to Cyril (whether he is today), that it is now correct. You just n

Re: [go-nuts] Re: Range over int

2024-02-23 Thread Duncan Harris
I made some changes to use range over int in our code base and was pleasantly surprised with the improvement in readability. We had quite a few instances where the number of iterations involved a function call which we don't want to repeat: - for i, n := 0, f(); i < n; i++ { + for i := range f(

Re: [go-nuts] Re: assert library with generics?

2024-02-23 Thread Pierre Durand
https://pkg.go.dev/github.com/pierrre/assert#section-readme Le vendredi 23 février 2024 à 09:34:43 UTC+1, Harmen a écrit : > On Thu, Feb 22, 2024 at 04:41:53PM -0800, Seth Hoenig wrote: > > https://github.com/shoenig/test > > > > We've been using this for a couple years now, and it's been great.

[go-nuts] coverage seems to show code as not covered, but code is actually executed

2024-02-23 Thread 'TheDiveO' via golang-nuts
I've noticed what looks at its surface that some code that is covered doesn't show up in the cover profile data. Unfortunately, I don't have a minimal example as I have no idea how to drill down. So please bear with my explanations and hopefully it's a problem between VT100 and chair, I just do

Re: [go-nuts] Re: assert library with generics?

2024-02-23 Thread Harmen
On Thu, Feb 22, 2024 at 04:41:53PM -0800, Seth Hoenig wrote: > https://github.com/shoenig/test > > We've been using this for a couple years now, and it's been great. I am > biased though, for obvious reasons. It makes use of the go-cmp library > under the hood for creating legible diffs, and int