-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add license tools for repositories without vendor directories. #121
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Needed for upcoming work for tektoncd/pipeline#1538. This change makes 2 changes to support Go module enabled repos without vendor directories. 1) Use go-licenses instead of dep-collector for third_party license notices. dep-collector makes heavy assumptions about the existence of the vendor directory. go-licenses is a module aware alternative. 2) Ignore the `+build tools` flag when building/testing projects. This is to allow tool dependencies to be specified with Go modules following the recommendation of https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM, just one question
@@ -167,7 +167,7 @@ function default_build_test_runner() { | |||
go build -v ./... || failed=1 | |||
# Get all build tags in go code (ignore /vendor) | |||
local tags="$(grep -r '// +build' . \ | |||
| grep -v '^./vendor/' | cut -f3 -d' ' | sort | uniq | tr '\n' ' ')" | |||
| grep -v '^./vendor/' | grep -v '^./third_party/' | grep -v "+build tools" | cut -f3 -d' ' | sort | uniq | tr '\n' ' ')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wlynch why the grep -v "+build tools"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to exclude packages containing binary dependencies, as specified by https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module.
Added a comment to document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM 👼
We may way to run a go mod tidy
on this but it's a nit.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
/lgtm
Changes
Needed for upcoming work for
tektoncd/pipeline#1538.
This change makes 2 changes to support Go module enabled repos
without vendor directories.
notices. dep-collector makes heavy assumptions about the existence of
the vendor directory. go-licenses is a module aware alternative.
+build tools
flag when building/testing projects. Thisis to allow tool dependencies to be specified with Go modules following
the recommendation of
https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide
for more details.