Skip to content

Commit 764f347

Browse files
authored
refactor: remove use of cbor.DecodeGeneric (#432)
Fixes #409 Signed-off-by: Aurora Gaffney <[email protected]>
1 parent d584c7b commit 764f347

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/indexer/datum.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
// DNSReferenceRefScriptDatum represents the auto-discovery datum type for scripts that handle DNS records
1616
type DNSReferenceRefScriptDatum struct {
17-
// This allows the type to be used with cbor.DecodeGeneric
1817
cbor.StructAsArray
1918
TldName []byte
2019
SymbolDrat []byte
@@ -56,5 +55,12 @@ func (d *DNSReferenceRefScriptDatum) UnmarshalCBOR(cborData []byte) error {
5655
tmpDataInner.Constructor(),
5756
)
5857
}
59-
return cbor.DecodeGeneric(tmpDataInner.FieldsCbor(), d)
58+
// Decode constr field data without using our custom decode function
59+
type tDNSReferenceRefScriptDatum DNSReferenceRefScriptDatum
60+
var tmpScriptDatum tDNSReferenceRefScriptDatum
61+
if _, err := cbor.Decode(tmpDataInner.FieldsCbor(), &tmpScriptDatum); err != nil {
62+
return err
63+
}
64+
*d = DNSReferenceRefScriptDatum(tmpScriptDatum)
65+
return nil
6066
}

0 commit comments

Comments
 (0)