mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
hack/vendor.sh: run "go mod tidy" before vendoring
The hack/vendor.sh script is used to (re)vendor dependencies. However, it did not run `go mod tidy` before doing so, wheras the vendor _validation_ script did. This could result in vendor validation failing if go mod tidy resulted in changes (which could be in `vendor.sum`). In "usual" situations, this could be easily done by the user (`go mod tidy` before running `go mod vendor`), but due to our (curent) uses of `vendor.mod`, and having to first set up a (dummy) `go.mod`, this is more complicated. Instead, just make the script do this, so that `hack/vendor.sh` will always produce the expected result. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
f0e057f0e5
commit
325c3a457b
2 changed files with 2 additions and 7 deletions
|
@ -3,11 +3,6 @@
|
||||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
source "${SCRIPTDIR}/.validate"
|
source "${SCRIPTDIR}/.validate"
|
||||||
|
|
||||||
go_mod_tidy(){
|
|
||||||
${SCRIPTDIR}/../go-mod-prepare.sh
|
|
||||||
GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.17
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_vendor_diff(){
|
validate_vendor_diff(){
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
check_files=( 'vendor.sum' 'vendor.mod' 'vendor/' )
|
check_files=( 'vendor.sum' 'vendor.mod' 'vendor/' )
|
||||||
|
@ -54,6 +49,5 @@ validate_vendor_used() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
go_mod_tidy
|
|
||||||
validate_vendor_diff
|
validate_vendor_diff
|
||||||
validate_vendor_used
|
validate_vendor_used
|
||||||
|
|
|
@ -8,9 +8,10 @@ set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
${SCRIPTDIR}/go-mod-prepare.sh
|
"${SCRIPTDIR}"/go-mod-prepare.sh
|
||||||
|
|
||||||
if [ $# -eq 0 ] || [ "$1" != "archive/tar" ]; then
|
if [ $# -eq 0 ] || [ "$1" != "archive/tar" ]; then
|
||||||
|
GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.17
|
||||||
GO111MODULE=auto go mod vendor -modfile vendor.mod
|
GO111MODULE=auto go mod vendor -modfile vendor.mod
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue