Change:
I ran update- Not to see a ton of errors Kubernetes version (use ): HEAD of master
There are no sig labels on this issue. Please add an appropriate label by using one of the following commands: - Please see the for a listing of the SIGs, working groups, and committees available. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/sig architecture (code organization / dependencies) /sig testing (hack scripts)
/triage accepted

Discussion:
# Capture local require/replace directives before running any go commands that can modify the go.mod file local require_json="${local_tmp_dir}/require.json" local replace_json="${local_tmp_dir}/replace.json" <del> go mod edit -json | jq -r ".Require // [] | sort | .[] | select(${require_filter})" > "${require_json}" go mod edit -json | jq -r ".Replace // [] | sort | .[] | select(${replace_filter})" > "${replace_json}" </del> <ins> go mod edit -json  | jq -r ".Require // [] | sort | .[] | select(${require_filter})"  > "${require_json}" go mod edit -json  | jq -r ".Replace // [] | sort | .[] | select(${replace_filter})"  > "${replace_json}" </ins> # 1a. Ensure replace directives have an explicit require directive <del> jq -r '"-require (.Old.Path)@(.New.Version)"' < "${replace_json}" | xargs -L 100 go mod edit -fmt </del> <ins> jq -r '"-require (.Old.Path)@(.New.Version)"' < "${replace_json}"  | xargs -L 100 go mod edit -fmt </ins> # 1b. Ensure require directives have a corresponding replace directive pinning a version <del> jq -r '"-replace (.Path)=(.Path)@(.Version)"' < "${require_json}" | xargs -L 100 go mod edit -fmt jq -r '"-replace (.Old.Path)=(.New.Path)@(.New.Version)"' < "${replace_json}" | xargs -L 100 go mod edit -fmt </del> <ins> jq -r '"-replace (.Path)=(.Path)@(.Version)"' < "${require_json}"  | xargs -L 100 go mod edit -fmt jq -r '"-replace (.Old.Path)=(.New.Path)@(.New.Version)"' < "${replace_json}"  | xargs -L 100 go mod edit -fmt </ins> # 2. Propagate root replace/require directives into staging modules, in case we are downgrading, so they don't bump the root required version back up for repo in $(kube::util::list_staging_repos); do pushd "staging/src/k8s.io/${repo}" >/dev/null 2>&1 <del> jq -r '"-require (.Path)@(.Version)"' < "${require_json}" | xargs -L 100 go mod edit -fmt jq -r '"-replace (.Path)=(.Path)@(.Version)"' < "${require_json}" | xargs -L 100 go mod edit -fmt jq -r '"-replace (.Old.Path)=(.New.Path)@(.New.Version)"' < "${replace_json}" | xargs -L 100 go mod edit -fmt </del> <ins> jq -r '"-require (.Path)@(.Version)"' < "${require_json}"  | xargs -L 100 go mod edit -fmt jq -r '"-replace (.Path)=(.Path)@(.Version)"' < "${require_json}"  | xargs -L 100 go mod edit -fmt jq -r '"-replace (.Old.Path)=(.New.Path)@(.New.Version)"' < "${replace_json}"  | xargs -L 100 go mod edit -fmt </ins> popd >/dev/null 2>&1 done # 3. Add explicit require directives for indirect dependencies <del> go list -m -json all | jq -r 'select(.Main != true) | select(.Indirect == true) | "-require (.Path)@(.Version)"'          | xargs -L 100 go mod edit -fmt </del> <ins> go list -m -json all  | jq -r 'select(.Main != true) | select(.Indirect == true) | "-require (.Path)@(.Version)"'  | xargs -L 100 go mod edit -fmt </ins> # 4. Add explicit replace directives pinning dependencies that aren't pinned yet <del> go list -m -json all | jq -r 'select(.Main != true) | select(.Replace == null)  | "-replace (.Path)=(.Path)@(.Version)"' | xargs -L 100 go mod edit -fmt </del> <ins> go list -m -json all  | jq -r 'select(.Main != true) | select(.Replace == null)  | "-replace (.Path)=(.Path)@(.Version)"'  | xargs -L 100 go mod edit -fmt </ins> } function group_replace_directives() {

kube::log::status "go.mod: update staging references" # Prune <del> go mod edit -json | jq -r '.Require[]? | select(.Version == "v0.0.0")                 | "-droprequire (.Path)"'     | xargs -L 100 go mod edit -fmt go mod edit -json | jq -r '.Replace[]? | select(.New.Path | startswith("./staging/")) | "-dropreplace (.Old.Path)"' | xargs -L 100 go mod edit -fmt </del> <ins> go mod edit -json  | jq -r '.Require[]? | select(.Version == "v0.0.0")                 | "-droprequire (.Path)"'  | xargs -L 100 go mod edit -fmt go mod edit -json  | jq -r '.Replace[]? | select(.New.Path | startswith("./staging/")) | "-dropreplace (.Old.Path)"'  | xargs -L 100 go mod edit -fmt </ins> # Readd <del> kube::util::list_staging_repos | xargs -n 1 -I {} echo "-require k8s.io/{}@v0.0.0"                  | xargs -L 100 go mod edit -fmt kube::util::list_staging_repos | xargs -n 1 -I {} echo "-replace k8s.io/{}=./staging/src/k8s.io/{}" | xargs -L 100 go mod edit -fmt </del> <ins> kube::util::list_staging_repos  | while read -r X; do echo "-require k8s.io/${X}@v0.0.0"; done  | xargs -L 100 go mod edit -fmt kube::util::list_staging_repos  | while read -r X; do echo "-replace k8s.io/${X}=./staging/src/k8s.io/${X}"; done  | xargs -L 100 go mod edit -fmt </ins> # Phase 3: capture required (minimum) versions from all modules, and replaced (pinned) versions from the root module

pushd "staging/src/k8s.io/${repo}" >/dev/null 2>&1 echo "=== propagating to ${repo}" >> "${LOG_FILE}" # copy root go.mod, changing module name <del> sed "s#module k8s.io/kubernetes#module k8s.io/${repo}#" < "${KUBE_ROOT}/go.mod" > "${KUBE_ROOT}/staging/src/k8s.io/${repo}/go.mod" </del> <ins> sed "s#module k8s.io/kubernetes#module k8s.io/${repo}#"  < "${KUBE_ROOT}/go.mod"  > "${KUBE_ROOT}/staging/src/k8s.io/${repo}/go.mod" </ins> # remove `require` directives for staging components (will get re-added as needed by `go list`) <del> kube::util::list_staging_repos | xargs -n 1 -I {} echo "-droprequire k8s.io/{}"   | xargs -L 100 go mod edit </del> <ins> kube::util::list_staging_repos  | while read -r X; do echo "-droprequire k8s.io/${X}"; done  | xargs -L 100 go mod edit </ins> # rewrite `replace` directives for staging components to point to peer directories <del> kube::util::list_staging_repos | xargs -n 1 -I {} echo "-replace k8s.io/{}=../{}" | xargs -L 100 go mod edit </del> <ins> kube::util::list_staging_repos  | while read -r X; do echo "-replace k8s.io/${X}=../${X}"; done  | xargs -L 100 go mod edit </ins> popd >/dev/null 2>&1 done

# tidy staging repos in reverse dependency order. # the content of dependencies' go.mod files affects what `go mod tidy` chooses to record in a go.mod file. tidy_unordered="${TMP_DIR}/tidy_unordered.txt" <del> kube::util::list_staging_repos | xargs -I {} echo "k8s.io/{}" > "${tidy_unordered}" </del> <ins> kube::util::list_staging_repos  | xargs -I {} echo "k8s.io/{}" > "${tidy_unordered}" </ins> rm -f "${TMP_DIR}/tidy_deps.txt" # SC2094 checks that you do not read and write to the same file in a pipeline. # We do read from ${tidy_unordered} in the pipeline and mention it within the

comm -23  <(go mod edit -json | jq -r '.Replace[] | .Old.Path' | sort)  <(go list -m -json all | jq -r .Path | sort) | <del> xargs -L 1 -I {} echo "-dropreplace={}" | </del> <ins> while read -r X; do echo "-dropreplace=${X}"; done | </ins> xargs -L 100 go mod edit -fmt # prune replace directives that pin to the naturally selected version