@@ -27,7 +27,7 @@ import (
27
27
// Helpful wrapper for parsing arbitrary CBOR data which may contain types that
28
28
// cannot be easily represented in Go (such as maps with bytestring keys)
29
29
type Value struct {
30
- value interface {}
30
+ value any
31
31
// We store this as a string so that the type is still hashable for use as map keys
32
32
cborData string
33
33
}
@@ -78,7 +78,7 @@ func (v *Value) UnmarshalCBOR(data []byte) error {
78
78
v .value = tmpTagDecode
79
79
}
80
80
default :
81
- var tmpValue interface {}
81
+ var tmpValue any
82
82
if _ , err := Decode (data , & tmpValue ); err != nil {
83
83
return err
84
84
}
@@ -91,7 +91,7 @@ func (v Value) Cbor() []byte {
91
91
return []byte (v .cborData )
92
92
}
93
93
94
- func (v Value ) Value () interface {} {
94
+ func (v Value ) Value () any {
95
95
return v .value
96
96
}
97
97
@@ -160,20 +160,20 @@ func (v *Value) processArray(data []byte) error {
160
160
return nil
161
161
}
162
162
163
- func generateAstJson (obj interface {} ) ([]byte , error ) {
164
- tmpJsonObj := map [string ]interface {} {}
163
+ func generateAstJson (obj any ) ([]byte , error ) {
164
+ tmpJsonObj := map [string ]any {}
165
165
switch v := obj .(type ) {
166
166
case []byte :
167
167
tmpJsonObj ["bytes" ] = hex .EncodeToString (v )
168
168
case ByteString :
169
169
tmpJsonObj ["bytes" ] = hex .EncodeToString (v .Bytes ())
170
170
case WrappedCbor :
171
171
tmpJsonObj ["bytes" ] = hex .EncodeToString (v .Bytes ())
172
- case []interface {} :
172
+ case []any :
173
173
return generateAstJsonList [[]any ](v )
174
174
case Set :
175
175
return generateAstJsonList [Set ](v )
176
- case map [interface {}] interface {} :
176
+ case map [any ] any :
177
177
return generateAstJsonMap [map [any ]any ](v )
178
178
case Map :
179
179
return generateAstJsonMap [Map ](v )
@@ -376,12 +376,12 @@ func (l *LazyValue) MarshalJSON() ([]byte, error) {
376
376
return l .value .MarshalJSON ()
377
377
}
378
378
379
- func (l * LazyValue ) Decode () (interface {} , error ) {
379
+ func (l * LazyValue ) Decode () (any , error ) {
380
380
err := l .value .UnmarshalCBOR ([]byte (l .value .cborData ))
381
381
return l .Value (), err
382
382
}
383
383
384
- func (l * LazyValue ) Value () interface {} {
384
+ func (l * LazyValue ) Value () any {
385
385
return l .value .Value ()
386
386
}
387
387
0 commit comments