214 } else {
215 failed = append(failed, result)
216 }
217 pingResults = append(pingResults, result)218 }
219
220 sort.Sort(allResults(success))
The result of append is not used anywhere.
The append
built-in function appends elements to the end of a slice.
If it has sufficient capacity, the destination is resliced to accommodate the
new elements. If it does not, a new underlying array will be allocated.
append
returns the updated slice. It is, therefore, often recommended to store
the result of append
in the variable holding the slice itself.
a := []int{1, 2}
append(a, 3)
// Value of a is still [1, 2] as when append(a, 3) is called,
// a newly underlyting array is allocated and it is necessary
// to store the update slice descriptor returned by append.
a := []int{1, 2}
a = append(a, 3)