-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Refactor writing Terraform resources #14723
Refactor writing Terraform resources #14723
Conversation
elem := v.Index(i) | ||
if elem.Kind() == reflect.Pointer { | ||
// TODO can these ever be nil? | ||
elem = elem.Elem() |
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.
Agree that panic-ing here probably makes sense. It would be surprising to have a nil in a list of strings...
|
||
func (s *sliceObject) Write(buffer *bytes.Buffer, indent int, key string) { | ||
for _, member := range s.members { | ||
member.Write(buffer, indent, key) |
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 was surprised we didn't need [
or ,
here. But now I see that it's because these are slices of objects, which are just written without delimeters. Makes sense, but a comment might be helpful here.
This LGTM, and we do have test coverage. /lgtm /hold to give others a chance to comment, but I think you can self-remove the hold after a few hours @johngmyers |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
Argh, pushed commit to wrong branch. Removed. |
You sure? |
6864a99
to
272171e
Compare
I'm having a bad git day, I suppose. |
/lgtm |
/retest |
This is the big one; a lot of type combinations needed to be covered.
The risk is that there's some combination of types that exists in our code but isn't exercised by our integration tests. I tested a version where all nil pointers were replaced by zero values and all empty slices were replaced by a slice containing a zero value. That didn't produce any panics. So the risk would be a resource type that isn't exercised at all in the integration tests.