On Tue, 22 Nov 2022 02:28:14 -0800 (PST)
Nikhilesh Susarla <nikhilesh1...@gmail.com> wrote:

> Hi, 
> 
> type Duration int64
> 
> The current Duration is int64 and the duration value should never be
> less than 0 else it will panic. It would be safe and advisable to
> change it to uint64 or so, where at least it would not cause panic. 
> 
> Is there any reason for not using uint?
> 

A negative duration is required to compute time.Time-d, using
Time.Add(-Duration) [1].
Also, Time.Sub may return negative too.

[1] https://pkg.go.dev/time#Time.Sub

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20221122173816.07ed2f06%40inspiro.localdomain.

Attachment: pgpaaCaq6qWJ4.pgp
Description: OpenPGP digital signature

Reply via email to