@@ -22,11 +22,11 @@ type DataReadingsPost struct {
2222type DataReading struct {
2323 // ClusterID is optional as it can be inferred from the agent
2424 // token when using basic authentication.
25- ClusterID string `json:"cluster_id,omitempty"`
26- DataGatherer string `json:"data-gatherer"`
27- Timestamp Time `json:"timestamp"`
28- Data interface {} `json:"data"`
29- SchemaVersion string `json:"schema_version"`
25+ ClusterID string `json:"cluster_id,omitempty"`
26+ DataGatherer string `json:"data-gatherer"`
27+ Timestamp Time `json:"timestamp"`
28+ Data any `json:"data"`
29+ SchemaVersion string `json:"schema_version"`
3030}
3131
3232// UnmarshalJSON implements the json.Unmarshaler interface for DataReading.
@@ -61,11 +61,11 @@ func (o *DataReading) UnmarshalJSON(data []byte) error {
6161
6262 // Define a list of decoding attempts with prioritized types
6363 dataTypes := []struct {
64- target interface {}
65- assign func (interface {} )
64+ target any
65+ assign func (any )
6666 }{
67- {& DiscoveryData {}, func (v interface {} ) { o .Data = v .(* DiscoveryData ) }},
68- {& DynamicData {}, func (v interface {} ) { o .Data = v .(* DynamicData ) }},
67+ {& DiscoveryData {}, func (v any ) { o .Data = v .(* DiscoveryData ) }},
68+ {& DynamicData {}, func (v any ) { o .Data = v .(* DynamicData ) }},
6969 }
7070
7171 // Attempt to decode the Data field into each type
@@ -82,7 +82,7 @@ func (o *DataReading) UnmarshalJSON(data []byte) error {
8282
8383// jsonUnmarshalStrict unmarshals JSON data into the provided interface,
8484// disallowing unknown fields to ensure strict adherence to the expected structure.
85- func jsonUnmarshalStrict (data []byte , v interface {} ) error {
85+ func jsonUnmarshalStrict (data []byte , v any ) error {
8686 decoder := json .NewDecoder (bytes .NewReader (data ))
8787 decoder .DisallowUnknownFields ()
8888 return decoder .Decode (v )
@@ -92,8 +92,8 @@ func jsonUnmarshalStrict(data []byte, v interface{}) error {
9292type GatheredResource struct {
9393 // Resource is a reference to a k8s object that was found by the informer
9494 // should be of type unstructured.Unstructured, raw Object
95- Resource interface {} `json:"resource"`
96- DeletedAt Time `json:"deleted_at,omitempty"`
95+ Resource any
96+ DeletedAt Time
9797}
9898
9999func (v GatheredResource ) MarshalJSON () ([]byte , error ) {
@@ -103,8 +103,8 @@ func (v GatheredResource) MarshalJSON() ([]byte, error) {
103103 }
104104
105105 data := struct {
106- Resource interface {} `json:"resource"`
107- DeletedAt string `json:"deleted_at,omitempty"`
106+ Resource any `json:"resource"`
107+ DeletedAt string `json:"deleted_at,omitempty"`
108108 }{
109109 Resource : v .Resource ,
110110 DeletedAt : dateString ,
@@ -116,7 +116,7 @@ func (v GatheredResource) MarshalJSON() ([]byte, error) {
116116func (v * GatheredResource ) UnmarshalJSON (data []byte ) error {
117117 var tmpResource struct {
118118 Resource * unstructured.Unstructured `json:"resource"`
119- DeletedAt Time `json:"deleted_at,omitempty "`
119+ DeletedAt Time `json:"deleted_at"`
120120 }
121121
122122 d := json .NewDecoder (bytes .NewReader (data ))
0 commit comments