Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: Print panics when printing a recursive object #44942

Closed
mr-tron opened this issue Mar 11, 2021 · 1 comment
Closed

fmt: Print panics when printing a recursive object #44942

mr-tron opened this issue Mar 11, 2021 · 1 comment

Comments

@mr-tron
Copy link

mr-tron commented Mar 11, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/prog/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/prog/gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/prog/gopath/go1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/prog/gopath/go1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1698464147=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cat << EOF > /tmp/main.go
package main

import  "fmt"

func main() {
	m := map[string]interface{}{}
	m["abc"] = m

	fmt.Print(m)
}
EOF
go run /tmp/main.go

What did you expect to see?

map[abc:<recursive lookup &0xc0000140d8>]
or something like this

What did you see instead?

panic after stack overflow

go run main.go Output
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020160358 stack=[0xc020160000, 0xc040160000]
fatal error: stack overflow

runtime stack:
runtime.throw(0x4bc2a3, 0xe)
/home/user/prog/gopath/go1.16/src/runtime/panic.go:1117 +0x72
runtime.newstack()
/home/user/prog/gopath/go1.16/src/runtime/stack.go:1069 +0x7ed
runtime.morestack()
/home/user/prog/gopath/go1.16/src/runtime/asm_amd64.s:458 +0x8f

goroutine 1 [running]:
runtime.assertE2I2(0x4a77e0, 0x4a2840, 0xc006367410, 0x0, 0x0, 0x0)
/home/user/prog/gopath/go1.16/src/runtime/iface.go:494 +0xa5 fp=0xc020160368 sp=0xc020160360 pc=0x40a7c5
fmt.(*pp).handleMethods(0xc00006a8f0, 0xc000000076, 0x0)
/home/user/prog/gopath/go1.16/src/fmt/print.go:590 +0x88 fp=0xc020160598 sp=0xc020160368 pc=0x493ba8
fmt.(*pp).printValue(0xc00006a8f0, 0x4a2840, 0xc006367410, 0x98, 0x76, 0x12491f)
/home/user/prog/gopath/go1.16/src/fmt/print.go:723 +0x2585 fp=0xc020160758 sp=0xc020160598 pc=0x497185
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x12491e)
/home/user/prog/gopath/go1.16/src/fmt/print.go:778 +0xda8 fp=0xc020160918 sp=0xc020160758 pc=0x4959a8
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367400, 0x94, 0x76, 0x12491d)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020160ad8 sp=0xc020160918 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x12491c)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020160c98 sp=0xc020160ad8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063673e0, 0x94, 0x76, 0x12491b)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020160e58 sp=0xc020160c98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x12491a)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020161018 sp=0xc020160e58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063673c0, 0x94, 0x76, 0x124919)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201611d8 sp=0xc020161018 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124918)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020161398 sp=0xc0201611d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063673a0, 0x94, 0x76, 0x124917)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020161558 sp=0xc020161398 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124916)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020161718 sp=0xc020161558 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367380, 0x94, 0x76, 0x124915)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201618d8 sp=0xc020161718 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124914)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020161a98 sp=0xc0201618d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367360, 0x94, 0x76, 0x124913)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020161c58 sp=0xc020161a98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124912)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020161e18 sp=0xc020161c58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367340, 0x94, 0x76, 0x124911)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020161fd8 sp=0xc020161e18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124910)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020162198 sp=0xc020161fd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367320, 0x94, 0x76, 0x12490f)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020162358 sp=0xc020162198 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x12490e)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020162518 sp=0xc020162358 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367300, 0x94, 0x76, 0x12490d)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201626d8 sp=0xc020162518 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x12490c)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020162898 sp=0xc0201626d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063672e0, 0x94, 0x76, 0x12490b)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020162a58 sp=0xc020162898 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x12490a)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020162c18 sp=0xc020162a58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063672c0, 0x94, 0x76, 0x124909)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020162dd8 sp=0xc020162c18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124908)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020162f98 sp=0xc020162dd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063672a0, 0x94, 0x76, 0x124907)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020163158 sp=0xc020162f98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124906)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020163318 sp=0xc020163158 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367280, 0x94, 0x76, 0x124905)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201634d8 sp=0xc020163318 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124904)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020163698 sp=0xc0201634d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367260, 0x94, 0x76, 0x124903)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020163858 sp=0xc020163698 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124902)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020163a18 sp=0xc020163858 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367240, 0x94, 0x76, 0x124901)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020163bd8 sp=0xc020163a18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x124900)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020163d98 sp=0xc020163bd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367220, 0x94, 0x76, 0x1248ff)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020163f58 sp=0xc020163d98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248fe)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020164118 sp=0xc020163f58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367200, 0x94, 0x76, 0x1248fd)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201642d8 sp=0xc020164118 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248fc)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020164498 sp=0xc0201642d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063671e0, 0x94, 0x76, 0x1248fb)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020164658 sp=0xc020164498 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248fa)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020164818 sp=0xc020164658 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063671c0, 0x94, 0x76, 0x1248f9)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201649d8 sp=0xc020164818 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248f8)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020164b98 sp=0xc0201649d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063671a0, 0x94, 0x76, 0x1248f7)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020164d58 sp=0xc020164b98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248f6)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020164f18 sp=0xc020164d58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367180, 0x94, 0x76, 0x1248f5)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201650d8 sp=0xc020164f18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248f4)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020165298 sp=0xc0201650d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367160, 0x94, 0x76, 0x1248f3)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020165458 sp=0xc020165298 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248f2)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020165618 sp=0xc020165458 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367140, 0x94, 0x76, 0x1248f1)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201657d8 sp=0xc020165618 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248f0)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020165998 sp=0xc0201657d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367120, 0x94, 0x76, 0x1248ef)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020165b58 sp=0xc020165998 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248ee)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020165d18 sp=0xc020165b58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367100, 0x94, 0x76, 0x1248ed)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020165ed8 sp=0xc020165d18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248ec)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020166098 sp=0xc020165ed8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063670e0, 0x94, 0x76, 0x1248eb)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020166258 sp=0xc020166098 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248ea)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020166418 sp=0xc020166258 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063670c0, 0x94, 0x76, 0x1248e9)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201665d8 sp=0xc020166418 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248e8)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020166798 sp=0xc0201665d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc0063670a0, 0x94, 0x76, 0x1248e7)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020166958 sp=0xc020166798 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248e6)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020166b18 sp=0xc020166958 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367080, 0x94, 0x76, 0x1248e5)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020166cd8 sp=0xc020166b18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248e4)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020166e98 sp=0xc020166cd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367060, 0x94, 0x76, 0x1248e3)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020167058 sp=0xc020166e98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248e2)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020167218 sp=0xc020167058 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367040, 0x94, 0x76, 0x1248e1)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201673d8 sp=0xc020167218 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248e0)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020167598 sp=0xc0201673d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367020, 0x94, 0x76, 0x1248df)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020167758 sp=0xc020167598 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248de)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020167918 sp=0xc020167758 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006367000, 0x94, 0x76, 0x1248dd)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020167ad8 sp=0xc020167918 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248dc)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020167c98 sp=0xc020167ad8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366fe0, 0x94, 0x76, 0x1248db)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020167e58 sp=0xc020167c98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248da)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020168018 sp=0xc020167e58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366fc0, 0x94, 0x76, 0x1248d9)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201681d8 sp=0xc020168018 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248d8)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020168398 sp=0xc0201681d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366fa0, 0x94, 0x76, 0x1248d7)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020168558 sp=0xc020168398 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248d6)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020168718 sp=0xc020168558 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366f80, 0x94, 0x76, 0x1248d5)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201688d8 sp=0xc020168718 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248d4)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020168a98 sp=0xc0201688d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366f60, 0x94, 0x76, 0x1248d3)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020168c58 sp=0xc020168a98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248d2)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020168e18 sp=0xc020168c58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366f40, 0x94, 0x76, 0x1248d1)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020168fd8 sp=0xc020168e18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248d0)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020169198 sp=0xc020168fd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366f20, 0x94, 0x76, 0x1248cf)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020169358 sp=0xc020169198 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248ce)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020169518 sp=0xc020169358 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366f00, 0x94, 0x76, 0x1248cd)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc0201696d8 sp=0xc020169518 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248cc)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020169898 sp=0xc0201696d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366ee0, 0x94, 0x76, 0x1248cb)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020169a58 sp=0xc020169898 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248ca)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020169c18 sp=0xc020169a58 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366ec0, 0x94, 0x76, 0x1248c9)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc020169dd8 sp=0xc020169c18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248c8)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc020169f98 sp=0xc020169dd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366ea0, 0x94, 0x76, 0x1248c7)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc02016a158 sp=0xc020169f98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248c6)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc02016a318 sp=0xc02016a158 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366e80, 0x94, 0x76, 0x1248c5)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc02016a4d8 sp=0xc02016a318 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248c4)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc02016a698 sp=0xc02016a4d8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366e60, 0x94, 0x76, 0x1248c3)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc02016a858 sp=0xc02016a698 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248c2)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc02016aa18 sp=0xc02016a858 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366e40, 0x94, 0x76, 0x1248c1)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc02016abd8 sp=0xc02016aa18 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248c0)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc02016ad98 sp=0xc02016abd8 pc=0x495a38
fmt.(*pp).printValue(0xc00006a8f0, 0x4a5220, 0xc006366e20, 0x94, 0x76, 0x1248bf)
/home/user/prog/gopath/go1.16/src/fmt/print.go:819 +0x178c fp=0xc02016af58 sp=0xc02016ad98 pc=0x49638c
fmt.(*pp).printValue(0xc00006a8f0, 0x4a6180, 0xc000068150, 0x15, 0xc000000076, 0x1248be)
/home/user/prog/gopath/go1.16/src/fmt/print.go:780 +0xe38 fp=0xc02016b118 sp=0xc02016af58 pc=0x495a38
...additional frames elided...
exit status 2

@mdlayher mdlayher changed the title Panic on printing recursive object via fmt.Print fmt: Print panics when printing a recursive object Mar 11, 2021
@toothrot
Copy link
Contributor

Hi @mr-tron,

It sounds like this is behaving as intended by the documentation. See also #8241:

Infinite recursion can also be triggered by self-referential data structures, such as a slice that contains itself as an element, if that type has a String method. Such pathologies are rare, however, and the package does not protect against them.

I'm going to close this as working as intended. Please let me know if I am mistaken.

@golang golang locked and limited conversation to collaborators Mar 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants