Skip to content

Commit

Permalink
clean up linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Dec 23, 2024
1 parent 1c127b8 commit 2fe88b9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions worker/pkg/benthos/transformers/transform_uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func init() {
randomizer := rng.New(seed)

return func() (any, error) {
res, err := transformUuid(randomizer, value)
res := transformUuid(randomizer, value)
if err != nil {
return nil, fmt.Errorf("unable to run transform_uuid: %w", err)
}
Expand Down Expand Up @@ -78,19 +78,15 @@ func (t *TransformUuid) Transform(value, opts any) (any, error) {
return nil, errors.New("value is not a string")
}

return transformUuid(parsedOpts.randomizer, valueStr)
return transformUuid(parsedOpts.randomizer, valueStr), nil
}

// Transforms an existing Uuid into a new UUid v5. This is mainly used to deterministically transform UUIDs using seed values into new UUIDs in situations where the existing UUIDs are considered sensitive.
func transformUuid(randomizer rng.Rand, value string) (*string, error) {
func transformUuid(randomizer rng.Rand, value string) *string {
if value == "" {
return &value, nil
return &value
}

// output := uuid.NewSHA1(uuid.MustParse(value), []byte{randomizer.Float64()}).String()

fmt.Println("the entry value", value)

randomFloat := randomizer.Float64()
randomBytes := make([]byte, 8)

Expand All @@ -100,5 +96,5 @@ func transformUuid(randomizer rng.Rand, value string) (*string, error) {

output := uuid.NewSHA1(uuid.MustParse(value), randomBytes).String()

return &output, nil
return &output
}

0 comments on commit 2fe88b9

Please sign in to comment.