-
Notifications
You must be signed in to change notification settings - Fork 16
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
chore: Adds staticcheck lint check #37
Conversation
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
ok to test |
producer/ue_authentication.go
Outdated
// Generates a random int between 0 and 255 | ||
func GenerateRandomNumber() (uint8, error) { | ||
randBytes := make([]byte, 1) | ||
_, err := rand.Read(randBytes) | ||
if err != nil { | ||
return 0, fmt.Errorf("error while generating random number: %s", err.Error()) | ||
} | ||
return randBytes[0], nil | ||
} |
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.
Why having a "different" function compared to the one proposed/merged in NRF #52 (also, shown below)? Should not this function be pretty much the same as the one in the NRF repo?
// Generates a random int between 0 and 99
func GenerateRandomNumber() (int, error) {
max := big.NewInt(100)
randomNumber, err := rand.Int(rand.Reader, max)
if err != nil {
return 0, err
}
return int(randomNumber.Int64()), nil
}
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.
I changed this to follow the same approach as in the NRF. I used to use bytes because we're outputting a value between 0-255 instead of an arbitrary value but it doesn't really make a difference. This is more standard with the last commit.
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.
+1 (tested changes with AiaB)
Description
Adds the
staticcheck
lint check and makes the required changes to have it pass.