Open jba opened 3 years ago
FWIW the expectation was that you'd do this by adding a test case to package licensecheck and then using
go test -tracedfa=N -run=Testdata/yourfile
Does that work in your context?
It does, and I was doing that. But it seems wrong to have to modify licensecheck when I'm debugging my own custom LREs, not ones I plan to add to the licensecheck corpus.
Add the Trace function, which sets the match.TraceDFA variable.
This is invaluable for debugging uses of this package.
As one example, you are faced with what seems to be a fine Apache-2.0 license that nonetheless isn't matched by any LRE. You try to compare the text to the LRE, but quickly realize that this task is toilsome and inaccurate. Calling Trace and running again immediately reveals that someone has s/product/bundle/, resulting in "reproduction" being altered to "rebundleion". (True story.)
Trace is also useful when writing custom LREs to capture new license variants.