update-go-mod updates itself too

Signed-off-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
Ryan Richard
2026-07-02 20:05:36 -07:00
parent bc143d995f
commit 5237171160
+11 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright 2023-2025 the Pinniped contributors. All Rights Reserved.
# Copyright 2023-2026 the Pinniped contributors. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
@@ -10,6 +10,8 @@ ROOT_DIR="$SCRIPT_DIR/../.."
GO_MOD="${ROOT_DIR}/go.mod"
echo "Updating $GO_MOD ..."
pushd "${SCRIPT_DIR}" >/dev/null
script=$(go run . "${GO_MOD}" overrides.conf)
popd >/dev/null
@@ -21,6 +23,14 @@ pushd "${ROOT_DIR}" >/dev/null
eval "$script"
popd >/dev/null
# Next update the go.mod of update-go-mod itself.
echo "Updating $SCRIPT_DIR/go.mod ..."
pushd "${SCRIPT_DIR}" >/dev/null
go get "golang.org/x/mod@latest"
go mod tidy
popd >/dev/null
# This script assumes that you are using the latest version of Go so it can detect its
# version and update all the go.mod files to use that version.
go_version="$(go version | cut -d ' ' -f3 | sed 's/^go//')"