d4x1 commented on PR #4662:
URL: 
https://github.com/apache/incubator-devlake/pull/4662#issuecomment-1471209768

   > Accroding to https://pkg.go.dev/math/rand#Seed
   > 
   >     1. The function is deprecated from go v1.20. but we are at v1.19 
https://github.com/apache/incubator-devlake/blob/main/backend/go.mod#L3 . We 
shouldn't remove it unless we upgrade to v1.20
   > 
   >     2. If we do so, I think the only thing we need to do is remove the 
`init` function since it will be seeded randomly automatically.
   
   Although it was marked deprecated since 1.20, `rand.New()` can work in 1.19 
https://pkg.go.dev/math/[email protected]#New . So this change is safe .I can see 
some  cases in main branch 
https://github.com/apache/incubator-devlake/blob/main/backend/core/plugin/plugin_utils.go#LL148
   
   As for the semantics, according to the comments in `rand.Seed`, 
`rand.New(source)` is equivalent to `rand.Seed && rand.Int`,  just like this PR 
did.
   
   Also we can use `rand.Int`to produce random integer, IMO, this two ways are 
equivalent. The both works.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to