A new function unregisterTemplateFunc is written to unregister a template function.
This intent for this function, is that it is used to help "wrap" an existing template with another. For example, the terraform provider generation "wraps" the golang template generation code. There exists a function getGolangPackage that is used by the SDK generation code to return the location of the SDK package. The terraform provider generation code overrides this, and pushes all SDK code into a sdk subfolder.
A new template method was registered, rather than allowing the existing behaviour to allow overrides implicitly because it's more explicit; and this is an advanced use-case.
Tests have minor adjusted to quickly allow regeneration of test data. If the expected/* file does not exist, it is written to. This implies the testdata/expected into a traditional snapshot test pattern, allowing rapid regeneration.
A new test is written to validate this behaviour works as expected.
unregisterTemplateFunc
is written to unregister a template function.getGolangPackage
that is used by the SDK generation code to return the location of the SDK package. The terraform provider generation code overrides this, and pushes all SDK code into asdk
subfolder.expected/*
file does not exist, it is written to. This implies thetestdata/expected
into a traditional snapshot test pattern, allowing rapid regeneration.