-
Notifications
You must be signed in to change notification settings - Fork 2k
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
api: fix a panic and tweak some exported types #16237
Conversation
This PR - fixes a panic in GetItems when looking up a variable that does not exist. - deprecates GetItems in favor of GetVariableItems which avoids returning a pointer to a map - deprecates ErrVariableNotFound in favor of ErrVariablePathNotFound which is an actual error type - does some minor code cleanup to make linters happier
698c41d
to
7827354
Compare
@@ -12,8 +12,16 @@ import ( | |||
) | |||
|
|||
const ( | |||
ErrVariableNotFound = "variable not found" | |||
ErrVariableMissingItems = "variable missing Items field" |
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.
note: ErrVariableMissingItems
wasn't used so ... should be safe to just remove?
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 checked in CT's nomad_var_get.go
and nomad_var_list.go
and found no consumers either. Technically breaking backcompat but I seriously doubt there are any real consumers.
@@ -12,8 +12,16 @@ import ( | |||
) | |||
|
|||
const ( | |||
ErrVariableNotFound = "variable not found" | |||
ErrVariableMissingItems = "variable missing Items field" |
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 checked in CT's nomad_var_get.go
and nomad_var_list.go
and found no consumers either. Technically breaking backcompat but I seriously doubt there are any real consumers.
// todo(shoenig): seems like this could just return a *Variable instead of taking | ||
// in a **Variable and modifying it? |
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 went back to look at the original PR for this and don't see any discussion of it. Maybe @angrycub will remember why we did this?
This PR
GetItems
when looking up a variable that does not existGetItems
in favor ofGetVariableItems
which avoids returning a pointer to amap
ErrVariableNotFound
in favor ofErrVariablePathNotFound
which is an actualerror
typeErrVariableMissingItems
Fixes #16236
Fixes #16235
Fixes #16234
No backport - we don't tag the api module anyway