google / google/go-cmp

How to add more context to Diff output?

Open
#358 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4.7k
Forks
243
PR merge metrics
No merged PRs in 30d

Description

I like the default output of the `.Diff()` function but would love more lines of context around the differences. After looking through different examples, I can't figure out how to do this. Digging into the code of `cmp`, it looks like the context is hardcoded to `2`
https://github.com/google/go-cmp/blob/c3ad8435e7bef96af35732bc0789e5a2278c6d5f/cmp/report_compare.go#L13

Is there a way to override this value?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.