# Why `go-cmp` is better than `reflect` ? ``` package main import ( "fmt" "reflect" "time" "github.com/google/go-cmp/cmp" ) func main() { loc, err := time.LoadLocation("Asia/Kolkata") if err != nil { panic(err) } fmt.Println(time.Now()) fmt.Println(time.Now().In(loc)) if reflect.DeepEqual(time.Now(), time.Now().In(loc)) { fmt.Println("Reflect fails in comparing same time in different zone") } if cmp.Diff(time.Now(), time.Now().In(loc)) == "" { fmt.Println("go-cmp rocks") } } ``` Result is ``` 2009-11-10 23:00:00 +0000 UTC m=+0.000000001 2009-11-11 04:30:00 +0530 IST go-cmp rocks ``` So one reason that I think is that it gives more control over comparing: For example, if you want extra control on comparing time objects: ignore timezone or wall time, it could be done in the cmp.Equal but not in reflect.DeepEqual. `cmp.Equal` tries to do a better job at this by: 1. Allowing the user to customize any portion of the comparison via Options. 2. Allowing the author of a type to specify the correct definition of comparison by implementing an Equal method. `cmp` does not claim to be the perfect comparison 100% of the time either, but the ability to specify Options allows an easy fix in the rare event of a comparison failure. For example, a type that your package depends on may add a new field that causes your comparison to fail. In some cases you would have wanted to ignore any newly added fields. In other cases, you do want to compare across newly added fields as well. Whatever decision the comparison library chooses to do will never be correct all the time, and Options help alleviate these rare (but inevitable) cases.