Skip to content

Commit

Permalink
Remove String method from VaryingDataTypeValue interface
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jan 11, 2023
1 parent 882de41 commit 543a8b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/scale/varying_data_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
// VaryingDataTypeValue is used to represent scale encodable types of an associated VaryingDataType
type VaryingDataTypeValue interface {
Index() uint
String() string
}

// VaryingDataTypeSlice is used to represent []VaryingDataType. SCALE requires knowledge
Expand Down Expand Up @@ -88,7 +87,11 @@ func (vdt VaryingDataType) String() string {
if vdt.value == nil {
return "VaryingDataType(nil)"
}
return vdt.value.String()
stringer, ok := vdt.value.(fmt.Stringer)
if !ok {
return fmt.Sprintf("VaryingDataType(%v)", vdt.value)
}
return stringer.String()
}

// NewVaryingDataType is constructor for VaryingDataType
Expand Down

0 comments on commit 543a8b0

Please sign in to comment.