Skip to content

Commit f2a5bd6

Browse files
authored
fix: use fmt.Appendf to add to byte buffer (#345)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent bac0477 commit f2a5bd6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/state/state.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (s *State) UpdateDomain(
248248
)
249249
}
250250
// Delete old records in tracking key that are no longer present after this update
251-
domainRecordsKey := []byte(fmt.Sprintf("d_%s_records", domainName))
251+
domainRecordsKey := fmt.Appendf(nil, "d_%s_records", domainName)
252252
domainRecordsItem, err := txn.Get(domainRecordsKey)
253253
if err != nil {
254254
if !errors.Is(err, badger.ErrKeyNotFound) {
@@ -289,13 +289,13 @@ func (s *State) LookupRecords(
289289
recordName = strings.Trim(recordName, `.`)
290290
err := s.db.View(func(txn *badger.Txn) error {
291291
for _, recordType := range recordTypes {
292-
keyPrefix := []byte(
293-
fmt.Sprintf(
294-
"r_%s_%s_",
295-
strings.ToUpper(recordType),
296-
recordName,
297-
),
292+
keyPrefix := fmt.Appendf(
293+
nil,
294+
"r_%s_%s_",
295+
strings.ToUpper(recordType),
296+
recordName,
298297
)
298+
299299
it := txn.NewIterator(badger.DefaultIteratorOptions)
300300
defer it.Close()
301301
for it.Seek(keyPrefix); it.ValidForPrefix(keyPrefix); it.Next() {

0 commit comments

Comments
 (0)