Skip to content

Commit

Permalink
Rewrite interface{} to any
Browse files Browse the repository at this point in the history
The type any is an alias for type interface{}.
  • Loading branch information
garyburd committed May 14, 2024
1 parent 62787cc commit 2890945
Show file tree
Hide file tree
Showing 21 changed files with 575 additions and 576 deletions.
12 changes: 6 additions & 6 deletions msgpack/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type DecodeConvertError struct {
// The MessagePack type of the value.
SrcType Type
// Option value.
SrcValue interface{}
SrcValue any
// Type of the Go value that could not be assigned to.
DestType reflect.Type
}
Expand Down Expand Up @@ -57,7 +57,7 @@ func (ds *decodeState) skip() {
}
}

func (ds *decodeState) saveErrorAndSkip(destValue reflect.Value, srcValue interface{}) {
func (ds *decodeState) saveErrorAndSkip(destValue reflect.Value, srcValue any) {
if ds.errSaved == nil {
ds.errSaved = &DecodeConvertError{
SrcType: ds.Type(),
Expand Down Expand Up @@ -95,7 +95,7 @@ func (ds *decodeState) saveErrorAndSkip(destValue reflect.Value, srcValue interf
// completes the decoding as best it can. If no more serious errors are
// encountered, Decode returns an DecodeConvertError describing the earliest
// such error.
func (d *Decoder) Decode(v interface{}) (err error) {
func (d *Decoder) Decode(v any) (err error) {
defer handleAbort(&err)
ds := &decodeState{
Decoder: d,
Expand Down Expand Up @@ -634,7 +634,7 @@ func (ev extensionValue) MarshalMsgPack(e *Encoder) error {
return e.PackExtension(ev.kind, ev.data)
}

func decodeNoReflect(ds *decodeState) (x interface{}) {
func decodeNoReflect(ds *decodeState) (x any) {
switch ds.Type() {
case Int:
return ds.Int()
Expand All @@ -652,7 +652,7 @@ func decodeNoReflect(ds *decodeState) (x interface{}) {
return ds.Bytes()
case ArrayLen:
n := ds.Len()
a := make([]interface{}, n)
a := make([]any, n)
for i := 0; i < n; i++ {
ds.unpack()
a[i] = decodeNoReflect(ds)
Expand All @@ -661,7 +661,7 @@ func decodeNoReflect(ds *decodeState) (x interface{}) {

case MapLen:
n := ds.Len()
m := make(map[string]interface{})
m := make(map[string]any)
for i := 0; i < n; i++ {
ds.unpack()

Expand Down
Loading

0 comments on commit 2890945

Please sign in to comment.