Remove error return value from NewUUID func
HemanthEverest opened this issue · 1 comments
I see NewUUID
internally call GetTime
which returns error
as a return value but this value will always be nil
(https://github.com/google/uuid/blob/master/time.go#L45-L67).
So, it doesn't make any sense to return error from NewUUID
when the value is always nil
.
Changing this will break existing code.
When the UUID package was first implemented, in 2011, GetTime called os.Time which could return an os.Error and GetTime passed that error to its caller, NewUUID, which in turn passes it back to its caller. When changed to use time.Now() there was no longer a path that would return an error, however, the signature could not be changed without breaking backwards compatibility.
If, someday, someone decides to fully follow the standard then a host wide persistent mechanism would need to be used to assure no two processes would ever return the same time value and it would always be monotonically increasing, even across reboots. In that case I guess an error could be returned again, but the real reason is what I said above.
You can see the checkin at pborman/uuid@e130d97#diff-9087329ff82d586a2f2e2393b726e00312bbd94506e54899e2012b93041bd698