You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
402 B
Go
23 lines
402 B
Go
package multilinediff
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/google/go-cmp/cmp/cmpopts"
|
|
)
|
|
|
|
func MultilineDiff(a, b, lineSep string) string {
|
|
reporter := Reporter{
|
|
LineSep: lineSep,
|
|
}
|
|
cmp.Diff(
|
|
a, b,
|
|
cmpopts.AcyclicTransformer("multiline", func(s string) []string {
|
|
return strings.Split(s, lineSep)
|
|
}),
|
|
cmp.Reporter(&reporter),
|
|
)
|
|
return reporter.String()
|
|
}
|