github.com/go-generalize/volcago@v1.7.0/pkg/sliceutil/sliceutil.go (about) 1 package sliceutil 2 3 // RemoveEmpty removes empty string elements from slice 4 func RemoveEmpty(slice []string) []string { 5 ret := make([]string, 0, len(slice)) 6 7 for i := range slice { 8 if slice[i] == "" { 9 continue 10 } 11 12 ret = append(ret, slice[i]) 13 } 14 15 return ret 16 }