Closed scottmason88 closed 1 year ago
I have all but the error in cmd/kn/main.go fixed, and was looking for some direction as to what the best course of action would be. The relevant code is below:
func init() {
rand.Seed(time.Now().UnixNano())
}
Since this has been deprecated, the 'new' way to do this is rand.New(rand.NewSource(seed)) which returns a Rand object. There are probably a few ways to fix this, and I'm also probably not aware of most of them as this is my first experience with golang. As this is also my first jump into this code, I wanted to have a discussion on the best way to move forward. My two thoughts are:
Paul Schweigert is mentoring me through this process, and suggested that I tag @rhuss and @dsimansk in this to get their opinion.
Thanks in advance!
Hey @scottmason88 , welcome on board :-)
Actually, I'd prefer a third option: Check where rand is used and seed it locally. Afais we are using a random number only in pkg/serving/service.go
when creating revision numbers. We can create a package local variable revisionNameRand
holding that seeded random variable number, in this package init() method in service.go.
The tricky part Is to update the test in service_test.go as this compares random numbers with the same seed (1), but instead of seeding it, you could replace the revisionNameRand variable with a 1-seeded rand before there tests.
Does this make sense ?
Bug report
Using Go 1.20 and building from source, I'm getting several errors.
Steps to reproduce the problem
Install Go 1.20, and run build.sh
kn version
I would like to start contributing to the project, and found this while attempting to build from source for the first time. I would like to be assigned the issue so I can work through the fix.