sdk-go
sdk-go copied to clipboard
Typed nil versioning ramp panics
Expected Behavior
The interface Ramp
is an optional field for VersioningAssignmentRule
, we should be able to set
it to nil
regardless of the type of the nil
object
Actual Behavior
Currently we can set it to untyped nil
, but with a typed nil
it panics with a
bad memory reference.
Steps to Reproduce the Problem
func Test_WorkerVersioningRules_typed_nil(t *testing.T) {
ramp := &VersioningRampByPercentage{
Percentage: 45.0,
}
ramp = nil
u := UpdateWorkerVersioningRulesOptions{
TaskQueue: "myQueue",
Operation: &VersioningOperationInsertAssignmentRule{
RuleIndex: 0,
Rule: VersioningAssignmentRule{
TargetBuildID: "2.0",
Ramp: ramp,
},
},
}
/// This panics....!!
_, err := u.validateAndConvertToProto("my_namespace")
}