Created
May 10, 2016 18:26
-
-
Save ffloyd/c4c6e347ac285bde32f03d404ef5a617 to your computer and use it in GitHub Desktop.
flatten_slice.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func flattenSlice(input *[][]interface{}) *[]interface{} { | |
capSum := 0 | |
for _, v := range *input { | |
capSum += cap(v) | |
} | |
result := make([]interface{}, 0, capSum) | |
for _, v := range *input { | |
result = append(result, v) | |
} | |
return &result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment