### Example Usage in a normal file Source: https://github.com/d4l3k/messagediff/blob/master/README.md Demonstrates how to use messagediff.PrettyDiff to compare two structs in a regular Go program. ```go package main import "gopkg.in/d4l3k/messagediff.v1" type someStruct struct { A, b int C []int } func main() { a := someStruct{1, 2, []int{1}} b := someStruct{1, 3, []int{1, 2}} diff, equal := messagediff.PrettyDiff(a, b) /* diff = `added: .C[1] = 2 modified: .b = 3` equal = false */ } ``` -------------------------------- ### Example Usage in a test Source: https://github.com/d4l3k/messagediff/blob/master/README.md Shows how to use messagediff.PrettyDiff within a Go test function to assert struct equality. ```go import "gopkg.in/d4l3k/messagediff.v1" ... type someStruct struct { A, b int C []int } func TestSomething(t *testing.T) { want := someStruct{1, 2, []int{1}} got := someStruct{1, 3, []int{1, 2}} if diff, equal := messagediff.PrettyDiff(want, got); !equal { t.Errorf("Something() = %#v\n%s", got, diff) } } ``` -------------------------------- ### Ignoring a field in a struct Source: https://github.com/d4l3k/messagediff/blob/master/README.md Illustrates how to use the `testdiff:"ignore"` tag to exclude specific fields from the diff comparison. ```go package main import "gopkg.in/d4l3k/messagediff.v1" type someStruct struct { A int B int `testdiff:"ignore"` } func main() { a := someStruct{1, 2} b := someStruct{1, 3} diff, equal := messagediff.PrettyDiff(a, b) /* equal = true diff = "" */ } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.