-
Notifications
You must be signed in to change notification settings - Fork 764
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
New Resource: github_user_gpg_key #120
Conversation
radeksimko
commented
Aug 9, 2018
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.
One nit about logging when removing from state. Other comments can safely be ignored 😄
key, _, err := client.Users.GetGPGKey(context.TODO(), id) | ||
if err != nil { | ||
d.SetId("") | ||
return 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.
Should log that the d.Id()
wasn't found and removed from state
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.
Agreed.
return err | ||
} | ||
|
||
d.SetId(strconv.FormatInt(*key.ID, 10)) |
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.
Should we use key.KeyID
here instead? Looking at GitHub docs it looks like key.ID
is a database index-like sequential key, where as KeyID
appears to be a unique id.
It also saves us the trouble of using FormatInt
and error checking
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 guess that depends on what GetGPGKey
uses... the docs make it look like it uses key_id
but I can't imagine your tests passed if that's what they expected and you weren't doing that 🤔
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've answered my own question. How bizarre 🤔
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.
The documentation is indeed a bit confusing on this one. I actually first tried to use the KeyID, before realizing it's the numeric ID and that the interface expects *int
. 😄
d662c8b
to
5f24c0c
Compare
…pg-key New Resource: github_user_gpg_key