Skip to content

Commit 7bf07e7

Browse files
committed
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.
1 parent 1d03cb4 commit 7bf07e7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/scaffold/v1/resource/addtoscheme.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ func (a *AddToScheme) Validate() error {
4848
return a.Resource.Validate()
4949
}
5050

51+
// NB(directxman12): we need that package alias on the API import otherwise imports.Process
52+
// gets wicked (or hella, if you're feeling west-coasty) confused.
53+
5154
var addResourceTemplate = `{{ .Boilerplate }}
5255
5356
package apis
5457
5558
import (
56-
"{{ .Repo }}/pkg/apis/{{ .Resource.Group }}/{{ .Resource.Version }}"
59+
api "{{ .Repo }}/pkg/apis/{{ .Resource.Group }}/{{ .Resource.Version }}"
5760
)
5861
5962
func init() {
6063
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
61-
AddToSchemes = append(AddToSchemes, {{ .Resource.Version }}.SchemeBuilder.AddToScheme)
64+
AddToSchemes = append(AddToSchemes, api.SchemeBuilder.AddToScheme)
6265
}
6366
`

0 commit comments

Comments
 (0)