Skip to content

Commit

Permalink
Check licenses only, but not bundle them (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Mar 27, 2024
1 parent b985a5b commit 47368d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
16 changes: 2 additions & 14 deletions library.sh
Expand Up @@ -772,8 +772,8 @@ function __go_update_deps_for_module() {
remove_broken_symlinks ./vendor
fi

group "Updating licenses"
update_licenses third_party/VENDOR-LICENSE "./..."
group "Checking licenses"
check_licenses
)
}

Expand Down Expand Up @@ -809,18 +809,6 @@ function run_kntest() {
go_run knative.dev/test-infra/tools/kntest/cmd/kntest@latest "$@"
}

# Run go-licenses to update licenses.
# Parameters: $1 - output file, relative to repo root dir.
# $2 - directory to inspect.
function update_licenses() {
local dst=$1
local dir=$2
shift
go_run github.com/google/go-licenses@v1.6.0 \
save "${dir}" --save_path="${dst}" --force || \
{ echo "--- FAIL: go-licenses failed to update licenses"; return 1; }
}

# Run go-licenses to check for forbidden licenses.
function check_licenses() {
# Check that we don't have any forbidden licenses.
Expand Down
5 changes: 2 additions & 3 deletions test/unit/update_deps_test.go
Expand Up @@ -22,12 +22,11 @@ func TestUpdateDeps(t *testing.T) {
contains("Golang module: knative.dev/hack/test"),
contains("Golang module: knative.dev/hack/schema"),
contains("Golang module: knative.dev/hack"),
contains("Updating licenses"),
contains("Checking licenses"),
contains("Removing unwanted vendor files"),
contains("go mod tidy"),
contains("go mod vendor"),
contains("go run github.com/google/go-licenses@v1.6.0 save ./... " +
"--save_path=third_party/VENDOR-LICENSE --force"),
contains("go run github.com/google/go-licenses@v1.6.0 check"),
},
}, {
name: "go_update_deps --upgrade",
Expand Down

0 comments on commit 47368d6

Please sign in to comment.