From db4429b32901c955c043b8d9e52706b15fe3b6a1 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 29 Mar 2020 19:33:26 +0200 Subject: [PATCH] ignore empty param renames when creating the spec, not after --- dynamic/spec.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dynamic/spec.go b/dynamic/spec.go index 35a5c5b..9e0871e 100644 --- a/dynamic/spec.go +++ b/dynamic/spec.go @@ -17,6 +17,9 @@ func makeSpec(service config.Service) spec { } for _, param := range service.Input { + if len(param.Rename) < 1 { + continue + } // make a pointer if optional if param.Optional { spec.Input[param.Rename] = reflect.PtrTo(param.ExtractType) @@ -26,6 +29,9 @@ func makeSpec(service config.Service) spec { } for _, param := range service.Output { + if len(param.Rename) < 1 { + continue + } spec.Output[param.Rename] = param.ExtractType } @@ -53,9 +59,6 @@ func (s spec) checkInput(fnv reflect.Value) error { // check for invalid param for name, ptype := range s.Input { - if len(name) < 1 { - continue - } if name[0] == strings.ToLower(name)[0] { return fmt.Errorf("%s: %w", name, ErrUnexportedName) } @@ -108,9 +111,6 @@ func (s spec) checkOutput(fnv reflect.Value) error { // fail on invalid output for name, ptype := range s.Output { - if len(name) < 1 { - continue - } if name[0] == strings.ToLower(name)[0] { return fmt.Errorf("%s: %w", name, ErrUnexportedName) }