-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added certz4.1 #3350
base: main
Are you sure you want to change the base?
added certz4.1 #3350
Conversation
Pull Request Functional Test Report for #3350 / 82c56dfVirtual Devices
Hardware Devices
|
Pull Request Test Coverage Report for Build 12602096852Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please address static-analysis issues.
//a valid check for trust not empty | ||
if len(trust) == 0 { | ||
return &certzpb.CertificateChain{} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion to not use the else here is valid.
} else { | ||
var prevCert *certzpb.CertificateChain | ||
var bundleToReturn *certzpb.CertificateChain | ||
for i := len(trust) - 1; i >= 0; i-- { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the purpose of this for loop?
why iterate with an integer counter instead of just:
for _, t := range trust {}
this pattern seems more golang-oriented, and avoids (I think) the -1 requirement.
var prevCert *certzpb.CertificateChain | ||
var bundleToReturn *certzpb.CertificateChain | ||
for i := len(trust) - 1; i >= 0; i-- { | ||
if i == len(trust)-1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if/else appears to serve 1 purpose: "Fill bundleToReturn on the first iteration"
Why not just fill that before the for loop?
If you fill the initial conditions before starting the loop you don' t need the if/else at all.
t.Fatalf("Error sending rotate request: %v", err) | ||
} | ||
rotateResponse := &certzpb.RotateCertificateResponse{} | ||
for i := 0; i < 6; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is 6 here? why magic number?
certz4.1Trust Bundle