Skip to content

Commit 55d1f5c

Browse files
committed
Apply suggestions
1 parent 80911d1 commit 55d1f5c

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

pkg/ottl/ottlfuncs/func_base64encode.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ func createBase64EncodeFunction[K any](_ ottl.FunctionContext, oArgs ottl.Argume
2727
return nil, errors.New("Base64EncodeFactory args must be of type *Base64EncodeArguments[K]")
2828
}
2929

30-
return Base64Encode(args.Target, args.Variant)
30+
return base64Encode(args.Target, args.Variant), nil
3131
}
3232

33-
func Base64Encode[K any](target ottl.StringGetter[K], variant ottl.Optional[ottl.StringGetter[K]]) (ottl.ExprFunc[K], error) {
33+
func base64Encode[K any](target ottl.StringGetter[K], variant ottl.Optional[ottl.StringGetter[K]]) ottl.ExprFunc[K] {
3434
return func(ctx context.Context, tCtx K) (any, error) {
3535
str, err := target.Get(ctx, tCtx)
3636
if err != nil {
@@ -59,5 +59,5 @@ func Base64Encode[K any](target ottl.StringGetter[K], variant ottl.Optional[ottl
5959
default:
6060
return nil, fmt.Errorf("unsupported base64 variant: %s", variantVal)
6161
}
62-
}, nil
62+
}
6363
}

pkg/ottl/ottlfuncs/func_base64encode_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
)
1515

1616
func TestBase64Encode(t *testing.T) {
17-
testValue := pcommon.NewValueStr("test string")
18-
1917
type testCase struct {
2018
name string
2119
value any
@@ -36,7 +34,7 @@ func TestBase64Encode(t *testing.T) {
3634
},
3735
{
3836
name: "convert Value to base64 (default variant)",
39-
value: testValue,
37+
value: pcommon.NewValueStr("test string"),
4038
want: "dGVzdCBzdHJpbmc=",
4139
},
4240
{

0 commit comments

Comments
 (0)