Comments (2)
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:
- Use a global, and change all the calls that used this seed to use it.
- Have the linter ignore this
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!
from client.
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 ?
from client.
Related Issues (20)
- Upgrade deprecated v1alpha1 DomainMapping API to newer one HOT 5
- Distinguish missing Serving/Eventing API from unsupported version HOT 8
- Fix shellcheck warnings in hack/build.sh script HOT 1
- Update plugin development docs HOT 5
- Can not get my broker through `kn broker list` HOT 6
- [48h Knative] KServe plugin HOT 4
- Align GVK format accepted by `--channel` flag HOT 12
- Flaky E2E test: e2e/TestDomain - create domain with TLS HOT 9
- Wrong version for kn create kafka channel HOT 7
- Add integration tests for all command usage examples in the binary HOT 6
- [48h Knative] Annotation and Label profiles HOT 1
- [48h Knative] Color output HOT 3
- [48h Knative] UX Evaluation HOT 11
- [48h Knative] Kamelet Sinks HOT 2
- [48h Knative] Command Usage Example Integration Testing POC HOT 4
- [48h Knative] Improved Logging HOT 7
- [48h Knative] Good first issues HOT 3
- Cmd `kn service wait` doesn't end on ready ksvc as expected
- CLI: `--user` option does not work as expected
- Add missing completion support for fish and PowerShell shells
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client.