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

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

Open
dotaheor opened this Issue Dec 12, 2017 · 3 comments

Comments

Projects
None yet
5 participants
@dotaheor

dotaheor commented Dec 12, 2017

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

@gopherbot gopherbot added this to the Proposal milestone Dec 12, 2017

@gopherbot gopherbot added the Proposal label Dec 12, 2017

@titanous

This comment has been minimized.

Member

titanous commented Dec 12, 2017

Can you describe in more detail what the differences are? Without running diff, it just looks like there's a newline in a different place.

@dotaheor

This comment has been minimized.

dotaheor commented Dec 13, 2017

@titanous yes, the newline makes the messages get a better readability.

@odeke-em

This comment has been minimized.

Member

odeke-em commented Dec 16, 2017

Gotcha @dotaheor. So this looks to me like an improvement that can be implemented without having to be a proposal and I can work on this. @randall77 am I right to say that we can JustDoIt (randall ™)?

@odeke-em odeke-em changed the title from proposal: cmd/compile: better format for multiple runtime panics to cmd/compile: delineate multiple runtime panics with newlines between them Dec 16, 2017

@odeke-em odeke-em modified the milestones: Proposal, Go1.11 Dec 16, 2017

@odeke-em odeke-em removed the Proposal label Dec 16, 2017

@odeke-em odeke-em changed the title from cmd/compile: delineate multiple runtime panics with newlines between them to cmd/compile: delineate multiple runtime panics by adding newlines between them Dec 16, 2017

@ianlancetaylor ianlancetaylor changed the title from cmd/compile: delineate multiple runtime panics by adding newlines between them to runtime: delineate multiple panics by adding newlines between them Jun 30, 2018

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Unplanned Jun 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment