From 2543b35da39f0b4920df5ae953fa3ba35ea18eae Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Thu, 24 Jun 2021 15:16:34 +1200 Subject: [PATCH] Allow TypeNames from external packages --- hack/generator/pkg/astmodel/type_walker.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hack/generator/pkg/astmodel/type_walker.go b/hack/generator/pkg/astmodel/type_walker.go index a5455f49c7e..ded84bde501 100644 --- a/hack/generator/pkg/astmodel/type_walker.go +++ b/hack/generator/pkg/astmodel/type_walker.go @@ -79,6 +79,11 @@ func (t *TypeWalker) visitTypeName(this *TypeVisitor, it TypeName, ctx interface panic(fmt.Sprintf("TypeWalker visitor visitTypeName must return a TypeName, instead returned %T", visitedTypeName)) } + if _, isLocal := it.PackageReference.AsLocalPackage(); !isLocal { + // Non-local type names are fine, we can exit early + return it, nil + } + def, ok := t.allTypes[it] if !ok { return nil, errors.Errorf("couldn't find type %q", it)