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

Add license tools for repositories without vendor directories. #121

Merged
merged 2 commits into from
Nov 27, 2019

Conversation

wlynch
Copy link
Member

@wlynch wlynch commented Nov 22, 2019

Changes

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.

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.

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 22, 2019
Copy link
Member

@dibyom dibyom left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 22, 2019
@dibyom dibyom requested a review from vdemeester November 22, 2019 19:42
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 22, 2019
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.
Copy link
Member

@vdemeester vdemeester left a 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' ' ')"
Copy link
Member

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" ?

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

Ah nice, thanks 👍

Copy link
Member

@vdemeester vdemeester left a 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.

/cc @bobcatfish @afrittoli

@tekton-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 27, 2019
Copy link
Member

@afrittoli afrittoli left a 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

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 27, 2019
@tekton-robot tekton-robot merged commit aeb838b into tektoncd:master Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants