mirror of https://github.com/golang/go.git
doc: simplify Append example in "Effective Go"
Change-Id: I011486993b167e65c69da1c8390bbcc625ca58c3 Reviewed-on: https://go-review.googlesource.com/64331 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
8bdf0b72b0
commit
c40579ac75
|
|
@ -1431,9 +1431,7 @@ func Append(slice, data []byte) []byte {
|
|||
slice = newSlice
|
||||
}
|
||||
slice = slice[0:l+len(data)]
|
||||
for i, c := range data {
|
||||
slice[l+i] = c
|
||||
}
|
||||
copy(slice[l:], data)
|
||||
return slice
|
||||
}
|
||||
</pre>
|
||||
|
|
|
|||
Loading…
Reference in New Issue