I want to compare 2 instance of the same struct to find out if it is equal, and got two different result.
- comment the code // fmt.Println("%#v ", a), the program output is "Equal"
- Use the fmt to print variable "a", then I got the output "Not Equal"
Please help me to find out Why???
I use golang 1.2.1
package main
import (
"fmt"
)
type example struct {
}
func init() {
_ = fmt.Printf
}
func main() {
a := new(example)
b := new(example)
// fmt.Println("%#v
", a)
if a == b {
println("Equals")
} else {
println("Not Equals")
}
}