unmarshalling type *armresourcehealth.Events: unmarshalling type *armresourcehealth.Events: struct field Value: unmarshalling type *armresourcehealth.Event: struct field Properties: unmarshalling type *armresourcehealth.EventProperties: struct field NewRate: json: cannot unmarshal string into Go value of type float64
Downgrading to v1.3.0 fixes the issue.
package main
import (
"context"
"log/slog"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth"
)
func main() {
subscriptionID := "..." // FIXME: replace with subscription ID
ctx := context.Background()
defaultCreds, err := azidentity.NewDefaultAzureCredential(&azidentity.DefaultAzureCredentialOptions{})
if err != nil {
slog.Error("failed to create defaultCreds", "error", err)
}
client, err := armresourcehealth.NewClientFactory(subscriptionID, defaultCreds, nil)
if err != nil {
slog.Error("failed to create armresourcehealth clientFactory", "error", err)
}
pager := client.NewEventsClient().NewListBySubscriptionIDPager(
&armresourcehealth.EventsClientListBySubscriptionIDOptions{
QueryStartTime: to.Ptr(time.Now().AddDate(0, 0, -30).Format("01/02/2006")),
},
)
for pager.More() {
_, err := pager.NextPage(ctx)
if err != nil {
slog.Error("failed to page resourcehealth events: ", "error", err)
}
}
}
Bug Report
import path of package in question:
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealthSDK version:
v1.4.0output of
go version: go1.26.5What happened?
We are consistently observing this unmarshalling error since upgrading from v1.3.0 to v1.4.0
Downgrading to v1.3.0 fixes the issue.
What did you expect or want to happen?
Events are properly unmarshalled as before
How can we reproduce it?
The above code works with v1.3.0 and fails with v1.4.0 of
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealthNothing special.