Closed batuhansk closed 4 years ago
Historical. This package is quite old and harkens from pre go 1.0 days in which os.Time() was used and could potentially return an error. uuid.New() returns a Version 4 UUID and has no error return while uuid.NewUUID() returns a Version 1 UUID and does have an error return. Version 1 UUIDs are rarely used, people almost always use Version 4 (random). The version 1 implementation is also not 100% correct as it technically requires persistent state outside of the application, probably another reason Version 1 UUIDs are not favored. At this point it would potentially be breaking to remove the error return and there is very little benefit in doing so.
Hey 👋🏼
I was curious about why
uuid.New()
may return an error then I noticed that theGetTime()
method has an error return parameter.Is there any acceptable reason to has an error value in the return parameters? There is no returned error in the
getTime()
method. Only returns nil value at the end of the method.https://github.com/google/uuid/blob/master/time.go#L66