google/go-cmp

Function pointers show an unnecessary diff

dprotaso opened this issue · 1 comments

https://go.dev/play/p/zyQHGQo293f

package main

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

func main() {
	x := func() {}
	y := x

	fmt.Println("Hello, 世界", cmp.Diff(x, y))
}

I would expect there to be no diff - but the output is

Hello, 世界   (func())(
- 	⟪0x50f0e0⟫,
+ 	⟪0x50f0e0⟫,
  )

This might be a go-ism since reflect.DeepEqual(x, y) is false

I'm guessing functions aren't comparable