mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-27 14:22:20 +02:00
sdk/hints: eliminate two unnecessary unsafe conversions on copy.
This commit is contained in:
@@ -3,7 +3,6 @@ package badgerh
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"unsafe"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
)
|
||||
@@ -11,7 +10,7 @@ import (
|
||||
func encodeKey(pubhintkey, relay string) []byte {
|
||||
k := make([]byte, 32+len(relay))
|
||||
hex.Decode(k[0:32], []byte(pubhintkey))
|
||||
copy(k[32:], unsafe.Slice(unsafe.StringData(relay), len(relay)))
|
||||
copy(k[32:], relay)
|
||||
return k
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user