Deep applies the given transform to the given body and then wraps the result such that any descendent blocks that are decoded will also have the transform applied to their bodies. This allows for language extensions that define a particular block type for a particular body and all nested blocks wit
(body hcl.Body, transformer Transformer)
| 25 | // only the methods defined for interface hcl.Body, and may not type-assert |
| 26 | // to access other methods. |
| 27 | func Deep(body hcl.Body, transformer Transformer) hcl.Body { |
| 28 | return deepWrapper{ |
| 29 | Transformed: transformer.TransformBody(body), |
| 30 | Transformer: transformer, |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | // deepWrapper is a hcl.Body implementation that ensures that a given |
| 35 | // transformer is applied to another given body when content is extracted, |