Skip to content
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

Merged
merged 5 commits into from
Jan 5, 2024
Merged

chore: Adds staticcheck lint check #37

merged 5 commits into from
Jan 5, 2024

Conversation

gruyaume
Copy link
Contributor

@gruyaume gruyaume commented Jan 4, 2024

Description

Adds the staticcheck lint check and makes the required changes to have it pass.

@onf-bot
Copy link
Contributor

onf-bot commented Jan 4, 2024

Can one of the admins verify this patch?

1 similar comment
@onf-bot
Copy link
Contributor

onf-bot commented Jan 4, 2024

Can one of the admins verify this patch?

@gab-arrobo
Copy link
Contributor

ok to test

producer/ue_authentication.go Show resolved Hide resolved
producer/ue_authentication.go Outdated Show resolved Hide resolved
Comment on lines 30 to 38
// 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
}
Copy link
Contributor

@gab-arrobo gab-arrobo Jan 5, 2024

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
}

Copy link
Contributor Author

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.

Copy link
Contributor

@gab-arrobo gab-arrobo left a 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)

@gab-arrobo gab-arrobo merged commit 18c2823 into omec-project:master Jan 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants