Skip to content

Commit

Permalink
change bytes.Buffer for strings.Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillem committed Aug 27, 2024
1 parent eda522c commit 17eef71
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions destination/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package destination

import (
"bytes"
"errors"
"fmt"
"regexp"
Expand Down Expand Up @@ -143,13 +142,13 @@ func (c Config) ParseTopic() (topic string, f TopicFn, err error) {
}

// The topic is a valid template, return TopicFn.
var buf bytes.Buffer
var sb strings.Builder
return "", func(r opencdc.Record) (string, error) {
buf.Reset()
if err := t.Execute(&buf, r); err != nil {
sb.Reset()
if err := t.Execute(&sb, r); err != nil {
return "", fmt.Errorf("failed to execute topic template: %w", err)
}
topic := buf.String()
topic := sb.String()
if topic == "" {
return "", fmt.Errorf(
"topic not found on record %s using template %s",
Expand Down

0 comments on commit 17eef71

Please sign in to comment.