Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

licensecheck: add Trace function #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

licensecheck: add Trace function #35

wants to merge 1 commit into from

Conversation

jba
Copy link
Contributor

@jba jba commented Jan 14, 2021

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.

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.
@google-cla google-cla bot added the cla: yes CLA for author on file label Jan 14, 2021
@rsc
Copy link
Collaborator

rsc commented Jan 27, 2021

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?

@jba
Copy link
Contributor Author

jba commented Jan 27, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA for author on file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants