Fix imports.Process being confused on v1
imports.Process makes some dubious assumptions about how import paths
correspond to package names (not wanting to believe that a normal import
path could possibly end in v1), and fails to properly double-check its
work.  Introduce an explicit alias to work around that.
@@ -48,16 +48,19 @@ func (a *AddToScheme) Validate() error {
return a.Resource.Validate()
}
+// NB(directxman12): we need that package alias on the API import otherwise imports.Process
+// gets wicked (or hella, if you're feeling west-coasty) confused.
+
var addResourceTemplate = `{{ .Boilerplate }}
package apis
import (
- "{{ .Repo }}/pkg/apis/{{ .Resource.Group }}/{{ .Resource.Version }}"
+ api "{{ .Repo }}/pkg/apis/{{ .Resource.Group }}/{{ .Resource.Version }}"
)
func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
- AddToSchemes = append(AddToSchemes, {{ .Resource.Version }}.SchemeBuilder.AddToScheme)
+ AddToSchemes = append(AddToSchemes, api.SchemeBuilder.AddToScheme)
}
`
