MCPcopy Create free account
hub / github.com/google/go-cmp / String

Method String

cmp/internal/diff/diff.go:42–59  ·  view source on GitHub ↗

String returns a human-readable string representing the edit-script where Identity, UniqueX, UniqueY, and Modified are represented by the '.', 'X', 'Y', and 'M' characters, respectively.

()

Source from the content-addressed store, hash-verified

40// Identity, UniqueX, UniqueY, and Modified are represented by the
41// '.', 'X', 'Y', and 'M' characters, respectively.
42func (es EditScript) String() string {
43 b := make([]byte, len(es))
44 for i, e := range es {
45 switch e {
46 case Identity:
47 b[i] = '.'
48 case UniqueX:
49 b[i] = 'X'
50 case UniqueY:
51 b[i] = 'Y'
52 case Modified:
53 b[i] = 'M'
54 default:
55 panic("invalid edit-type")
56 }
57 }
58 return string(b)
59}
60
61// stats returns a histogram of the number of each type of edit operation.
62func (es EditScript) stats() (s struct{ NI, NX, NY, NM int }) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected