From d4100a055ef78db7d52c94814cc70a702dff8571 Mon Sep 17 00:00:00 2001 From: Michael Aldridge Date: Thu, 18 Mar 2021 01:01:56 -0700 Subject: [PATCH] Fix NOTICE generation --- .goreleaser.yml | 1 + scripts/prepare.sh | 3 +++ scripts/vendor-licenses | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100755 scripts/prepare.sh diff --git a/.goreleaser.yml b/.goreleaser.yml index ecbe0f3..b1d2692 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,7 @@ before: hooks: - go mod vendor + - scripts/prepare.sh builds: - goos: - darwin diff --git a/scripts/prepare.sh b/scripts/prepare.sh new file mode 100755 index 0000000..a40b20f --- /dev/null +++ b/scripts/prepare.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +./scripts/vendor-licenses > NOTICE diff --git a/scripts/vendor-licenses b/scripts/vendor-licenses index 2a418fd..e09f235 100755 --- a/scripts/vendor-licenses +++ b/scripts/vendor-licenses @@ -19,7 +19,7 @@ list_files() { generate_notice() { last= - $0 -all | while IFS=$'\n' read license; do + $0 -all | while IFS=$'\n' read -r license; do pkg="${license%%::*}" if [ "$pkg" != "$license" ]; then license="${license#${pkg}::}" @@ -28,7 +28,7 @@ generate_notice() { pkg="${pkg%/*}" fi - printf ${last:+'\n\n\n'} + printf "%s" "${last:+'\n\n\n'}" last=x echo "$pkg" | sed 'p;s/./-/g'