Safely copy paths to new *bo.Options#672
Conversation
Signed-off-by: jakenichols2719 <jnichols2719@protonmail.com>
Pull Request Test Coverage Report for Build 5083532234
💛 - Coveralls |
|
Something is missing,in paths's SetDefaults() have a line : p.Custom = make([]string, 0) . take memory for Custom. your modify will lost Custom. |
|
I'll have to get back to you on that specific chunk, I need to check with the original author to see what's meant to happen there. |
Signed-off-by: jakenichols2719 <jnichols2719@protonmail.com>
Signed-off-by: jakenichols2719 <jnichols2719@protonmail.com>
I meant to get back to you on this earlier, sorry. Slice size is automatically updated when you append to them, so the issue isn't the allocation here. We've discovered that the issue is (probably) that configs are reaching Merge before Custom is assigned to by SetDefault. That's why you're seeing empty Custom fields when Merge happens sometimes. Working on a fix! |
The
SetDefaultsfunction now copies over custom paths to the returned options by iterating the "old" routes (after they've had their own SetDefaults called) and setting the value for each key to a clone of the "old" value.This was brought to my attention in issue #671, and my testing indicates that it resolves that issue; however, due to issues with the posted config (happens with copying over sometimes), my test wasn't an exact replica, so I will wait to hear from the issue creator. #655 was mentioned as a possible cause, and resolving that was what lead to this solution.
Closes #655.