• Gustavo Niemeyer's avatar
    bytes: fix Replace so it actually copies · d16ceca5
    Gustavo Niemeyer authored
    The documentation for bytes.Replace says it copies
    the slice but it won't necessarily copy them.  Since
    the data is mutable, breaking the contract is an issue.
    
    We either have to fix this by making the copy at all
    times, as suggested in this CL, or we should change the
    documentation and perhaps make better use of the fact
    it's fine to mutate the slice in place otherwise.
    
    R=golang-dev, bradfitz, adg, rsc
    CC=golang-dev
    https://golang.org/cl/5081043
    d16ceca5
bytes_test.go 20.6 KB