From 12a6d525e11e5a7ea032fec3e2086fce49ec9c94 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 29 Sep 2021 12:55:13 +0200 Subject: [PATCH] .github/workflows/compliance/ls-deps.pl: extract all 3rd-party deps ... from `go list -deps` input. --- .github/workflows/compliance/ls-deps.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 .github/workflows/compliance/ls-deps.pl diff --git a/.github/workflows/compliance/ls-deps.pl b/.github/workflows/compliance/ls-deps.pl new file mode 100755 index 00000000..a7a033ad --- /dev/null +++ b/.github/workflows/compliance/ls-deps.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use warnings; +use strict; +use autodie qw(:all); + +my @mods = <>; +chomp @mods; +s~^vendor/~~ for @mods; + +@mods = grep m~^[^./]+\.~, @mods; +@mods = grep !m~^golang\.org/x(?:/|$)~, @mods; +@mods = grep !m~^github\.com/icinga/icingadb(?:/|$)~, @mods; +@mods = sort @mods; + +my $lastMod = undef; + +for (@mods) { + # prefixed with last mod (e.g. "go.uber.org/zap/buffer" after "go.uber.org/zap"), so redundant + next if defined($lastMod) && /$lastMod/; + + $lastMod = '^' . quotemeta("$_/"); + print "$_\n" +}