From 190a69e0573a68c27a4cbda968fadf4eec3c1d60 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Fri, 11 Oct 2013 16:39:05 -0700 Subject: go.blog/slices: make slice-header-modifying example actually modify it Fixes golang/go#6570. R=golang-dev, adg CC=golang-dev https://golang.org/cl/14614043 --- content/slices/prog020.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'content/slices') diff --git a/content/slices/prog020.go b/content/slices/prog020.go index 4652722..472f68a 100644 --- a/content/slices/prog020.go +++ b/content/slices/prog020.go @@ -12,7 +12,8 @@ var buffer [256]byte var slice []byte = buffer[100:150] func SubtractOneFromLength(slice []byte) []byte { - return slice[0 : len(slice)-1] + slice = slice[0 : len(slice)-1] + return slice } func main() { -- cgit v1.2.3