Goroutine stack exceeds 250000000-byte limit

232 views
Skip to first unread message

Runix

unread,
Jan 23, 2015, 4:32:09 AM1/23/15
to golan...@googlegroups.com
Hi, this is a bug in fmt.Println or behavior described?

package main

import "fmt"

func main() {
var a []interface{}
a = make([]interface{}, 0, 10)
a = append(a,
append(a, 2, 3, 4),
append(a, 5, 6, 7),
append(a, 8, 9, 10),
append(a, 11, 12, 13))
fmt.Println(a)
}

runtime: goroutine stack exceeds 250000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x1a4aee, 0x381c5)
	/tmp/sandbox/go/src/pkg/runtime/panic.c:520 +0xa0
runtime.newstack()
	/tmp/sandbox/go/src/pkg/runtime/stack.c:770 +0x580
runtime.morestack()
	/tmp/sandbox/go/src/pkg/runtime/asm_amd64p32.s:207 +0x80

goroutine 16 [stack growth]:

Jan Mercl

unread,
Jan 23, 2015, 5:19:11 AM1/23/15
to Runix, golan...@googlegroups.com
> On Fri Jan 23 2015 at 10:32:15 Runix <rsu...@gmail.com> wrote:
>
> Hi, this is a bug in fmt.Println or behavior described?
http://play.golang.org/p/JbFloYc1yK

The outer append creates a cycle. The inner appends must be unpacked using ... (but then you can append only one of those at a time).

-j



Reply all
Reply to author
Forward
0 new messages