VSChina / magic-modules

Magic Modules: Automagically generate Google Cloud Platform support for OSS
Apache License 2.0
1 stars 4 forks source link

[Feature Request] MM should handle errors when setting schema data and tags #53

Closed ArcturusZhang closed 4 years ago

ArcturusZhang commented 4 years ago

For instance, in read function, currently mm will only generate the following code:

    d.Set("idle_timeout_in_minutes", natGatewayPropertiesFormat.IdleTimeoutInMinutes)

Ideally, this piece of code should be:

if err := d.Set("idle_timeout_in_minutes", natGatewayPropertiesFormat.IdleTimeoutInMinutes); err != nil {
    return fmt.Errorf("Error setting `idle_timeout_in_minutes`: %+v", err)
}
HoukChen commented 4 years ago

It seems that in Hashcorp's coding style, we only check errors when flatten functions are involved in Set. While in the above example, the field can be extracted directly.

Let's wait for more feedbacks from other reviewers about this situation.