From 915759672f45b06d7af128a8b49edceedc31463d Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 13 Jul 2015 12:42:13 +0800 Subject: [PATCH] bytes.ReplaceAt bugfix --- bytes.v7/replace.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bytes.v7/replace.go b/bytes.v7/replace.go index e0ff138..a62a161 100644 --- a/bytes.v7/replace.go +++ b/bytes.v7/replace.go @@ -17,8 +17,7 @@ func ReplaceAt(b []byte, off, nsrc int, dest []byte) []byte { } if ndelta > 0 { - tailoff := len(b) - ndelta - b = append(b, b[tailoff:]...) + b = append(b, dest[:ndelta]...) copy(b[off+len(dest):], b[off+nsrc:]) copy(b[off:], dest) } else {