Skip to content

Conversation

@eliottness
Copy link
Contributor

I did random stuff to make things a little bit better

Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness eliottness requested a review from a team as a code owner September 27, 2024 14:07
}()
return f()
res = f()
return

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Code Quality Violation

avoid using a bare return (...read more)

The "Avoid bare returns" rule in Go static analysis is designed to increase clarity and readability in your code. A bare return is when a function that has named return values returns those values implicitly, without explicitly stating what is being returned.

While Go's allowance for bare returns can make code more concise, it can also make it more difficult to understand and debug, especially in larger functions. Implicitly relying on the state of named return values can lead to unexpected behavior if those values are modified elsewhere in the function.

To adhere to this rule and promote better coding practices, always explicitly return values in your functions. This makes it clear what values are being returned and in what state, reducing the chance of bugs and making your code easier to understand. For example, instead of writing return in a function that returns an int and a bool, write return 0, false.

Learn More

View in Datadog  Leave us feedback  Documentation

@eliottness eliottness merged commit 24e43d9 into main Oct 2, 2024
100 checks passed
@eliottness eliottness deleted the eliott.bouhana/misc-refactor branch October 2, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants