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

Wrapped errors diff output is confusing #202

Closed
dprotaso opened this issue May 19, 2020 · 2 comments
Closed

Wrapped errors diff output is confusing #202

dprotaso opened this issue May 19, 2020 · 2 comments

Comments

@dprotaso
Copy link

Two errors with the same messsage but constructed differently when compared produce a diff that looks identical

https://play.golang.org/p/i3y-6_rqonr

package main

import (
	"fmt"
	"errors"
	
	"github.com/google/go-cmp/cmp"
)

func main() {
	e1 := errors.New("Hello world!")
	e2 := fmt.Errorf("Hello %w", errors.New("world!"))
	
	
	fmt.Println(cmp.Diff(e1, e2))
}

Results in

 interface{}(
- 	e"Hello world!",
+ 	e"Hello world!",
  )
@dsnet
Copy link
Collaborator

dsnet commented May 19, 2020

Thanks for the report. It is a known issue with the reporter that it needs to do more work trying to disambiguate cases like these.

@dsnet
Copy link
Collaborator

dsnet commented Jun 9, 2020

Closing as duplicate of #194

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

No branches or pull requests

2 participants