Skip to content

Add include_tests flag for deps only used in tests#160

Merged
Bobgy merged 4 commits intogoogle:masterfrom
davidhsingyuchen:load-test-packages
Oct 23, 2022
Merged

Add include_tests flag for deps only used in tests#160
Bobgy merged 4 commits intogoogle:masterfrom
davidhsingyuchen:load-test-packages

Conversation

@davidhsingyuchen
Copy link
Copy Markdown
Contributor

PR fixes #62. PR is based on the work of @blanet.

@Bobgy
Copy link
Copy Markdown
Collaborator

Bobgy commented Oct 19, 2022

Thank you!
Can we get @blanet's consent?

@blanet
Copy link
Copy Markdown

blanet commented Oct 19, 2022

Oh, I'm sorry for being offline for so long. It's great that @davidhsingyuchen picked up my old work and fell free to base on them if they can help. I'm totally consent with this @Bobgy .

@Bobgy
Copy link
Copy Markdown
Collaborator

Bobgy commented Oct 20, 2022

@davidhsingyuchen can you fix the test?

@davidhsingyuchen
Copy link
Copy Markdown
Contributor Author

@Bobgy Thanks for the reminder. make precommit exits with 0 now.

Copy link
Copy Markdown
Collaborator

@Bobgy Bobgy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!
Thank you for the great contribution!

Would you mind also update README with its documentation?

@davidhsingyuchen
Copy link
Copy Markdown
Contributor Author

davidhsingyuchen commented Oct 23, 2022

@Bobgy Thank you for the review! I try to follow the other sections in README to explain why this flag may be useful. Please let me know if the tone sounds good to you, thanks!

README.md Outdated
### Include testing packages

Use the `--include_tests` global flag to include packages only imported by testing code.
For example, those packages could be testing libraries/frameworks.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, testing libraries or frameworks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a complete sentence though. I merged the two sentences to make it more concise.

README.md Outdated
Use the `--include_tests` global flag to include packages only imported by testing code.
For example, those packages could be testing libraries/frameworks.
Usually you would want to add this flag because if you're already analyzing the licenses of your dependencies,
likely those packages also need to be taken into account.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably omit this?

you described what effect this flag has, I think it is reasonable to let users decide whether they need the flag.

I would use the flag when running check, because all deps must be allowed.

when saving report for a binary, I won't use it, because testing libraries are not included.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, updated.

README.md Outdated
Example command:

```shell
go-licenses check --include_tests "github.com/google/go-licenses"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try github.com/google/go-licenses/... ?

Just checking the root package may not include all deps used. It seems more reasonable to check all pkgs.

Copy link
Copy Markdown
Contributor Author

@davidhsingyuchen davidhsingyuchen Oct 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking the root package may not include all deps used. It seems more reasonable to check all pkgs.

Makes sense. Probably this is also worth mentioning in ### Check? If it sounds good to you, I can create a follow-up PR to update that to make this PR focused.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #162 accordingly.

Copy link
Copy Markdown
Collaborator

@Bobgy Bobgy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you again!

@Bobgy Bobgy merged commit 6073243 into google:master Oct 23, 2022
@davidhsingyuchen davidhsingyuchen deleted the load-test-packages branch October 23, 2022 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can not detect license of packages imported only in tests

3 participants