apidiff support internal go modules

The kubernetes repository contains some internal golang modules that are
not part of the golang global workspace. Because apidiff is currently
run from the root of the repository, it does not work against this
internal modules.

Instead of executing apidiff from the root we can just cd into the
passed path of the module to avoid this limitation.
This commit is contained in:
Antonio Ojea 2024-11-28 15:42:59 +00:00
parent 95d71c464a
commit e6fccc36d8

View File

@ -156,7 +156,12 @@ run () {
out="$1"
mkdir -p "$out"
for d in "${targets[@]}"; do
apidiff -m -w "${out}/$(output_name "${d}")" "${d}"
# cd to the path for modules that are intree but not part of the go workspace
# per example staging/src/k8s.io/code-generator/examples
(
cd "${d}"
apidiff -m -w "${out}/$(output_name "${d}")" .
)
done
}