Skip to content

runtime: delineate multiple panics by adding newlines between them #23097

Open
@dotaheor

Description

@dotaheor

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.2 linux/amd64

What did you do?

// a.go
package main

func main() {
	var s []int
	var is interface{} = s
	go func() {
		_ = s == nil
	}()
	go func() {
		_ = is == is
	}()
	
	var m map[string]bool = nil
	_ = m["Go"]
	_, _ = m["Go"]
	m, _ = is.(map[string]bool)
	m = is.(map[string]bool)
}

What did you expect to see?

$ go run a.go
panic: interface conversion: interface {} is []int, not map[string]bool

goroutine 1 [running]:
main.main()
	/tmp/a.go:17 +0x15a
panic: runtime error: comparing uncomparable type []int

goroutine 19 [running]:
main.main.func2(0x45b480, 0x4cc2c0)
	/tmp/a.go:10 +0x3a
created by main.main
	/tmp/a.go:9 +0xc9
exit status 2

What did you see instead?

$ go run a.go

panic: interface conversion: interface {} is []int, not map[string]bool
goroutine 1 [running]:
main.main()
	/tmp/a.go:17 +0x15a

panic: runtime error: comparing uncomparable type []int
goroutine 19 [running]:
main.main.func2(0x45b480, 0x4cc2c0)
	/tmp/a.go:10 +0x3a
created by main.main
	/tmp/a.go:9 +0xc9
exit status 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions