Skip to content

Commit

Permalink
go-get-kubernetes.sh: remove unused k8s libs
Browse files Browse the repository at this point in the history
go-get-kubernetes.sh should not add all Kubernetes libraries to "replace"
section, only those that are actually used.
  • Loading branch information
jsafrane committed Apr 14, 2021
1 parent 49b4269 commit 5b1de1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go-get-kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ mods=$( (set -x; curl --silent --show-error --fail "https://raw.githubuserconten
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
) || die "failed to determine Kubernetes staging modules"
for mod in $mods; do
if ! (env GO111MODULE=on go mod graph) | grep "$mod@" > /dev/null; then
echo "Kubernetes module $mod is not used, skipping"
# Remove the module from go.mod "replace" that was added by an older version of this script.
(set -x; env GO111MODULE=on go mod edit "-dropreplace=$mod") || die "'go mod edit' failed"
continue
fi
# The presence of a potentially incomplete go.mod file affects this command,
# so move elsewhere.
modinfo=$(set -x; cd /; env GO111MODULE=on go mod download -json "$mod@kubernetes-${k8s}") ||
Expand Down

0 comments on commit 5b1de1a

Please sign in to comment.