From cf41bcae85877cf79ee4e42312b5dd55244b6d2b Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Wed, 20 May 2026 21:25:30 -0500 Subject: [PATCH] align method receiver variable names --- internal/processor/int-scale.go | 8 ++++---- internal/processor/module-output.go | 18 +++++++++--------- internal/processor/router-input.go | 8 ++++---- internal/processor/struct-field-get.go | 10 +++++----- internal/processor/struct-method-get.go | 10 +++++----- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/internal/processor/int-scale.go b/internal/processor/int-scale.go index ead2932..09a99ce 100644 --- a/internal/processor/int-scale.go +++ b/internal/processor/int-scale.go @@ -18,7 +18,7 @@ type IntScale struct { config config.ProcessorConfig } -func (ir *IntScale) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { +func (is *IntScale) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { payload := wrappedPayload.Payload payloadInt, ok := common.GetAnyAs[int](payload) if !ok { @@ -26,13 +26,13 @@ func (ir *IntScale) Process(ctx context.Context, wrappedPayload common.WrappedPa return wrappedPayload, errors.New("int.scale can only process an int") } - payloadInt = (payloadInt-ir.InMin)*(ir.OutMax-ir.OutMin)/(ir.InMax-ir.InMin) + ir.OutMin + payloadInt = (payloadInt-is.InMin)*(is.OutMax-is.OutMin)/(is.InMax-is.InMin) + is.OutMin wrappedPayload.Payload = payloadInt return wrappedPayload, nil } -func (ir *IntScale) Type() string { - return ir.config.Type +func (is *IntScale) Type() string { + return is.config.Type } func init() { diff --git a/internal/processor/module-output.go b/internal/processor/module-output.go index bb6414a..13fecd3 100644 --- a/internal/processor/module-output.go +++ b/internal/processor/module-output.go @@ -18,29 +18,29 @@ type ModuleOutput struct { module common.OutputModule } -func (ro *ModuleOutput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { +func (mo *ModuleOutput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { - if ro.module == nil { + if mo.module == nil { if wrappedPayload.Modules == nil { wrappedPayload.End = true return wrappedPayload, errors.New("module.output wrapped payload has no modules") } - module, ok := wrappedPayload.Modules[ro.ModuleId] + module, ok := wrappedPayload.Modules[mo.ModuleId] if !ok { wrappedPayload.End = true - return wrappedPayload, fmt.Errorf("module.output unable to find module with id: %s", ro.ModuleId) + return wrappedPayload, fmt.Errorf("module.output unable to find module with id: %s", mo.ModuleId) } outputModule, ok := module.(common.OutputModule) if !ok { wrappedPayload.End = true - return wrappedPayload, fmt.Errorf("module.output module with id %s is not an OutputModule", ro.ModuleId) + return wrappedPayload, fmt.Errorf("module.output module with id %s is not an OutputModule", mo.ModuleId) } - ro.module = outputModule + mo.module = outputModule } - err := ro.module.Output(ctx, wrappedPayload.Payload) + err := mo.module.Output(ctx, wrappedPayload.Payload) if err != nil { wrappedPayload.End = true @@ -50,8 +50,8 @@ func (ro *ModuleOutput) Process(ctx context.Context, wrappedPayload common.Wrapp return wrappedPayload, nil } -func (ro *ModuleOutput) Type() string { - return ro.config.Type +func (mo *ModuleOutput) Type() string { + return mo.config.Type } func init() { diff --git a/internal/processor/router-input.go b/internal/processor/router-input.go index 4d2ae0c..f8af748 100644 --- a/internal/processor/router-input.go +++ b/internal/processor/router-input.go @@ -17,7 +17,7 @@ type RouterInput struct { logger *slog.Logger } -func (ro *RouterInput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { +func (ri *RouterInput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { payload := wrappedPayload.Payload if wrappedPayload.InputHandler == nil { @@ -25,7 +25,7 @@ func (ro *RouterInput) Process(ctx context.Context, wrappedPayload common.Wrappe return wrappedPayload, errors.New("router.input no input handler found") } - _, err := wrappedPayload.InputHandler(ctx, ro.SourceId, payload) + _, err := wrappedPayload.InputHandler(ctx, ri.SourceId, payload) if err != nil { wrappedPayload.End = true @@ -37,8 +37,8 @@ func (ro *RouterInput) Process(ctx context.Context, wrappedPayload common.Wrappe return wrappedPayload, nil } -func (ro *RouterInput) Type() string { - return ro.config.Type +func (ri *RouterInput) Type() string { + return ri.config.Type } func init() { diff --git a/internal/processor/struct-field-get.go b/internal/processor/struct-field-get.go index 86ce00c..8c0c578 100644 --- a/internal/processor/struct-field-get.go +++ b/internal/processor/struct-field-get.go @@ -16,7 +16,7 @@ type StructFieldGet struct { Name string } -func (sf *StructFieldGet) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { +func (sfg *StructFieldGet) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { payload := wrappedPayload.Payload s := reflect.ValueOf(payload) @@ -29,18 +29,18 @@ func (sf *StructFieldGet) Process(ctx context.Context, wrappedPayload common.Wra } } - field := s.FieldByName(sf.Name) + field := s.FieldByName(sfg.Name) if !field.IsValid() { wrappedPayload.End = true - return wrappedPayload, fmt.Errorf("struct.field.get field '%s' does not exist", sf.Name) + return wrappedPayload, fmt.Errorf("struct.field.get field '%s' does not exist", sfg.Name) } wrappedPayload.Payload = field.Interface() return wrappedPayload, nil } -func (sf *StructFieldGet) Type() string { - return sf.config.Type +func (sfg *StructFieldGet) Type() string { + return sfg.config.Type } func init() { diff --git a/internal/processor/struct-method-get.go b/internal/processor/struct-method-get.go index 3f65161..c770ee1 100644 --- a/internal/processor/struct-method-get.go +++ b/internal/processor/struct-method-get.go @@ -16,7 +16,7 @@ type StructMethodGet struct { Name string } -func (sm *StructMethodGet) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { +func (smg *StructMethodGet) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) { payload := wrappedPayload.Payload s := reflect.ValueOf(payload) @@ -29,10 +29,10 @@ func (sm *StructMethodGet) Process(ctx context.Context, wrappedPayload common.Wr } } - method := s.MethodByName(sm.Name) + method := s.MethodByName(smg.Name) if !method.IsValid() { wrappedPayload.End = true - return wrappedPayload, fmt.Errorf("struct.method.get method '%s' does not exist", sm.Name) + return wrappedPayload, fmt.Errorf("struct.method.get method '%s' does not exist", smg.Name) } value := method.Call(nil) @@ -58,8 +58,8 @@ func (sm *StructMethodGet) Process(ctx context.Context, wrappedPayload common.Wr return wrappedPayload, nil } -func (sm *StructMethodGet) Type() string { - return sm.config.Type +func (smg *StructMethodGet) Type() string { + return smg.config.Type } func init() {