Function return signatures #23
Closed
tarkatronic
started this conversation in
General
Replies: 2 comments 2 replies
-
@JoseAngel1196 @developerDemetri I figure you two might have input here. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Fixed via #24 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now a lot of functions in the code will detect error scenarios, or missing data, and return empty data structures. For example here:
vulnbot/config/config.go
Line 68 in 2f14fd6
I get the sense that this isn't really a best practice in Go, and it also leads to some code that just puts me on edge a bit. For example, to handle that return value we have to have this:
vulnbot/internal/scan.go
Line 229 in 2f14fd6
And that seems not great.
I suspect that, instead, we should change the return signature to
(TeamConfig, Error)
and return an error when no config is found. This seems to be far more the norm in Go code. Then to handle it, there's the standardDoes anybody have thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions