-
-
Notifications
You must be signed in to change notification settings - Fork 403
Closed
Labels
Description
Hi, thanks for your great work. A common error in our code base that happens over and over again is something like that:
t := time.Now()
t.Add(1 * time.Hour)
fmt.Println(t)
Since time.Time is a "value type", Add() does not modify the current value and returns a new time object, which is unused in the code above. Calling time.Add() without using the return value is always an error.
There are probably lots of similar functions in the standard library. The same check might be used to for time.In, strings.ToLower and strings.ToUpper as well.
Are you interested in a check like that, how should it be called and should I try to prepare a MR for it?
Reactions are currently unavailable