lo
lo copied to clipboard
Helper to fill slice to specific size (if needed)
Call: HelperFunc([]string{"a", "a"}, "b", 8)
Result: []string{"a", "a", "b", "b", "b", "b", "b", "b"}
Call: HelperFunc([]string{"a", "a", "a", "a", "a", "a", "a", "a"}, "b", 8)
Result: []string{"a", "a", "a", "a", "a", "a", "a", "a"}
Call: HelperFunc([]string{"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a"}, "b", 8)
Result: []string{"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a"}
Thus the helper does not remove data, just fill the slice with the value if its size is less than the required size.