aboutsummaryrefslogtreecommitdiff
path: root/cmp/report_text.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2019-06-06 11:30:24 -0700
committerGitHub <noreply@github.com>2019-06-06 11:30:24 -0700
commit1b316004397f1f336546ca058ddb5b95c41a8772 (patch)
treea04035d8e4a4098d19a5893a7bca072054ed7030 /cmp/report_text.go
parent917e382dab80060fd1f094402bfbb5137ec3c4ff (diff)
downloadgo-cmp-1b316004397f1f336546ca058ddb5b95c41a8772.tar.gz
Document the reason for output instability (#145)
Diffstat (limited to 'cmp/report_text.go')
-rw-r--r--cmp/report_text.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmp/report_text.go b/cmp/report_text.go
index 80605d0..0353b50 100644
--- a/cmp/report_text.go
+++ b/cmp/report_text.go
@@ -19,6 +19,11 @@ var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0
type indentMode int
func (n indentMode) appendIndent(b []byte, d diffMode) []byte {
+ // The output of Diff is documented as being unstable to provide future
+ // flexibility in changing the output for more humanly readable reports.
+ // This logic intentionally introduces instability to the exact output
+ // so that users can detect accidental reliance on stability early on,
+ // rather than much later when an actual change to the format occurs.
if flags.Deterministic || randBool {
// Use regular spaces (U+0020).
switch d {