I'm trying to compare 2 addresses, I can write code like p == q, but inside ```assert, it leads to run time problem, as below:
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAddress(t *testing.T) {
assert := assert. New(t)
p := new(int)
q := new(int)
assert.NotEqual(p, q) // error
var a struct{}
var b struct{}
assert. Equal(a, b)
i1 := new([0]int)
i2 := new([0]int)
assert.NotEqual(i1, i2) // error
}
The error message is:
Error Trace: d:\mycode\basic_test.go:11
Error: Should not be: (*int)(0xc0000178b8)
Test: TestAddress
Error Trace: d:\mycode\basic_test.go:19
Error: Should not be: &[0]int{}
Test: TestAddress
What does this error message indicate? How to fix it?