From 73d677460bdbb829ce3642858b99ee52d907e7c3 Mon Sep 17 00:00:00 2001 From: Cory Slep Date: Sat, 5 Jan 2019 23:19:50 +0100 Subject: [PATCH] Make manager interface for type packages have unique methods --- tools/exp/props/pkg.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/exp/props/pkg.go b/tools/exp/props/pkg.go index 551dd1a..40548f0 100644 --- a/tools/exp/props/pkg.go +++ b/tools/exp/props/pkg.go @@ -117,12 +117,17 @@ func (t *TypePackageGenerator) PublicDefinitions(tgs []*TypeGenerator) *codegen. // Precondition: The passed-in generators are the complete set of type // generators within a package. func (t *TypePackageGenerator) PrivateDefinitions(tgs []*TypeGenerator) (*jen.Statement, *codegen.Interface, *codegen.Function) { - var fns []codegen.FunctionSignature + fnsMap := make(map[string]codegen.FunctionSignature) for _, tg := range tgs { for _, m := range tg.getAllManagerMethods() { - fns = append(fns, m.ToFunctionSignature()) + v := m.ToFunctionSignature() + fnsMap[v.Name] = v } } + var fns []codegen.FunctionSignature + for _, v := range fnsMap { + fns = append(fns, v) + } return jen.Var().Id(managerInitName()).Id(managerInterfaceName), codegen.NewInterface(tgs[0].PrivatePackage().Path(), managerInterfaceName,