@@ -91,7 +91,7 @@ type Value interface {
9191 ValueType () ValueType
9292 // GetValue returns the underlying value that this Value holds. What type is returned here can be determined exactly
9393 // from the ValueType() of this Value (see the ValueType godoc).
94- GetValue () interface {} // TODO: rename to Get to read cleaner
94+ GetValue () any // TODO: rename to Get to read cleaner
9595 String () string
9696 MarshalJSON () ([]byte , error )
9797 // Equals returns true if this value equals the input Value.
@@ -107,7 +107,7 @@ type Value interface {
107107// Acceptable types: []int, []string, []byte, []float64, PixelDataInfo,
108108// [][]*Element (represents a sequence, which contains several
109109// items which each contain several elements).
110- func NewValue (data interface {} ) (Value , error ) {
110+ func NewValue (data any ) (Value , error ) {
111111 switch data .(type ) {
112112 case []int :
113113 return & intsValue {value : data .([]int )}, nil
@@ -127,11 +127,11 @@ func NewValue(data interface{}) (Value, error) {
127127 }
128128 return & sequencesValue {value : sequenceItems }, nil
129129 default :
130- return nil , ErrorUnexpectedDataType
130+ return nil , fmt . Errorf ( "NewValue: unexpected data type %T: %w" , data , ErrorUnexpectedDataType )
131131 }
132132}
133133
134- func mustNewValue (data interface {} ) Value {
134+ func mustNewValue (data any ) Value {
135135 v , err := NewValue (data )
136136 if err != nil {
137137 panic (err )
@@ -142,7 +142,7 @@ func mustNewValue(data interface{}) Value {
142142// NewElement creates a new DICOM Element with the supplied tag and with a value
143143// built from the provided data. The data can be one of the types that is
144144// acceptable to NewValue.
145- func NewElement (t tag.Tag , data interface {} ) (* Element , error ) {
145+ func NewElement (t tag.Tag , data any ) (* Element , error ) {
146146 tagInfo , err := tag .Find (t )
147147 if err != nil {
148148 return nil , err
@@ -164,15 +164,15 @@ func NewElement(t tag.Tag, data interface{}) (*Element, error) {
164164 }, nil
165165}
166166
167- func mustNewElement (t tag.Tag , data interface {} ) * Element {
167+ func mustNewElement (t tag.Tag , data any ) * Element {
168168 elem , err := NewElement (t , data )
169169 if err != nil {
170170 log .Panic (err )
171171 }
172172 return elem
173173}
174174
175- func mustNewPrivateElement (t tag.Tag , rawVR string , data interface {} ) * Element {
175+ func mustNewPrivateElement (t tag.Tag , rawVR string , data any ) * Element {
176176 value , err := NewValue (data )
177177 if err != nil {
178178 log .Panic (fmt .Errorf ("error creating value: %w" , err ))
@@ -217,9 +217,9 @@ type bytesValue struct {
217217 value []byte
218218}
219219
220- func (b * bytesValue ) isElementValue () {}
221- func (b * bytesValue ) ValueType () ValueType { return Bytes }
222- func (b * bytesValue ) GetValue () interface {} { return b .value }
220+ func (b * bytesValue ) isElementValue () {}
221+ func (b * bytesValue ) ValueType () ValueType { return Bytes }
222+ func (b * bytesValue ) GetValue () any { return b .value }
223223func (b * bytesValue ) String () string {
224224 return fmt .Sprintf ("%v" , b .value )
225225}
@@ -242,9 +242,9 @@ type stringsValue struct {
242242 value []string
243243}
244244
245- func (s * stringsValue ) isElementValue () {}
246- func (s * stringsValue ) ValueType () ValueType { return Strings }
247- func (s * stringsValue ) GetValue () interface {} { return s .value }
245+ func (s * stringsValue ) isElementValue () {}
246+ func (s * stringsValue ) ValueType () ValueType { return Strings }
247+ func (s * stringsValue ) GetValue () any { return s .value }
248248func (s * stringsValue ) String () string {
249249 return fmt .Sprintf ("%v" , s .value )
250250}
@@ -273,9 +273,9 @@ type intsValue struct {
273273 value []int
274274}
275275
276- func (i * intsValue ) isElementValue () {}
277- func (i * intsValue ) ValueType () ValueType { return Ints }
278- func (i * intsValue ) GetValue () interface {} { return i .value }
276+ func (i * intsValue ) isElementValue () {}
277+ func (i * intsValue ) ValueType () ValueType { return Ints }
278+ func (i * intsValue ) GetValue () any { return i .value }
279279func (i * intsValue ) String () string {
280280 return fmt .Sprintf ("%v" , i .value )
281281}
@@ -304,9 +304,9 @@ type floatsValue struct {
304304 value []float64
305305}
306306
307- func (f * floatsValue ) isElementValue () {}
308- func (f * floatsValue ) ValueType () ValueType { return Floats }
309- func (f * floatsValue ) GetValue () interface {} { return f .value }
307+ func (f * floatsValue ) isElementValue () {}
308+ func (f * floatsValue ) ValueType () ValueType { return Floats }
309+ func (f * floatsValue ) GetValue () any { return f .value }
310310func (f * floatsValue ) String () string {
311311 return fmt .Sprintf ("%v" , f .value )
312312}
@@ -345,7 +345,7 @@ func (s *SequenceItemValue) ValueType() ValueType { return SequenceItem }
345345// GetValue returns the underlying value that this Value holds. What type is
346346// returned here can be determined exactly from the ValueType() of this Value
347347// (see the ValueType godoc).
348- func (s * SequenceItemValue ) GetValue () interface {} { return s .elements }
348+ func (s * SequenceItemValue ) GetValue () any { return s .elements }
349349
350350// String is used to get a string representation of this struct.
351351func (s * SequenceItemValue ) String () string {
@@ -379,9 +379,9 @@ type sequencesValue struct {
379379 value []* SequenceItemValue
380380}
381381
382- func (s * sequencesValue ) isElementValue () {}
383- func (s * sequencesValue ) ValueType () ValueType { return Sequences }
384- func (s * sequencesValue ) GetValue () interface {} { return s .value }
382+ func (s * sequencesValue ) isElementValue () {}
383+ func (s * sequencesValue ) ValueType () ValueType { return Sequences }
384+ func (s * sequencesValue ) GetValue () any { return s .value }
385385func (s * sequencesValue ) String () string {
386386 // TODO: consider adding more sophisticated formatting
387387 return fmt .Sprintf ("%+v" , s .value )
@@ -440,9 +440,9 @@ type pixelDataValue struct {
440440 PixelDataInfo
441441}
442442
443- func (p * pixelDataValue ) isElementValue () {}
444- func (p * pixelDataValue ) ValueType () ValueType { return PixelData }
445- func (p * pixelDataValue ) GetValue () interface {} { return p .PixelDataInfo }
443+ func (p * pixelDataValue ) isElementValue () {}
444+ func (p * pixelDataValue ) ValueType () ValueType { return PixelData }
445+ func (p * pixelDataValue ) GetValue () any { return p .PixelDataInfo }
446446func (p * pixelDataValue ) String () string {
447447 if len (p .Frames ) == 0 {
448448 return "empty pixel data"
@@ -530,7 +530,7 @@ func MustGetPixelDataInfo(v Value) PixelDataInfo {
530530
531531// allValues is used for tests that need to pass in instances of the unexported
532532// value structs to cmp.AllowUnexported.
533- var allValues = []interface {} {
533+ var allValues = []any {
534534 floatsValue {},
535535 intsValue {},
536536 stringsValue {},
0 commit comments