You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, the problem is, I want to write a unit_test for checking if pdata.AttributeValue.IsNil() but I can't.
I tried to use attributeMap.InsertNull("key") and the func NewAttributeValueNull() to create a Nil pdata.AttributeValue but they didn't work. Every-time I call pdata.AttributeValue.IsNil() it returns false. I feel something is wrong with these set of functions. I tried the following two ways. None of them worked to assign a Nil AttributeValue in a pdata.AttributeMap.
Example-1:
attributeMap := pdata.NewAttributeMap()
attributeMap.InsertNull("ClusterName")
if v, ok := attributeMap.Get("ClusterName"); ok {
if v.IsNil() {
fmt.Println("Nil Assigned") // Never comes here
} else {
fmt.Println("Not Nil")
}
}
Example-2:
attributeMap := pdata.NewAttributeMap()
attributeMap.InitEmptyWithCapacity(1)
attributeMap.Insert("ClusterName", pdata.NewAttributeValueNull())
if v, ok := attributeMap.Get("ClusterName"); ok {
if v.IsNil() {
fmt.Println("Nil Assigned") // Never comes here
} else {
fmt.Println("Not Nil")
}
}
The text was updated successfully, but these errors were encountered:
So, the problem is, I want to write a unit_test for checking
if pdata.AttributeValue.IsNil()
but I can't.I tried to use
attributeMap.InsertNull("key")
and the funcNewAttributeValueNull()
to create a Nilpdata.AttributeValue
but they didn't work. Every-time I callpdata.AttributeValue.IsNil()
it returns false. I feel something is wrong with these set of functions. I tried the following two ways. None of them worked to assign a Nil AttributeValue in apdata.AttributeMap
.Example-1:
Example-2:
The text was updated successfully, but these errors were encountered: