Change:
See, e.g. This seems to be blocking multiple PRs from even being tested.
Looking.
I think I figured it out. The order of generation matters. The verify script subtly breaks that by renaming and checking the files one at a time. The update script deletes everything and then recreates them.
I have a fix. Will send a PR shortly.

Discussion:
kube::golang::setup_env <ins> # The sort at the end makes sure we feed the topological sort a deterministic # list (since there aren't many dependencies). </ins> generated_files=($( find . -not (  ( 

-o -wholename '*/Godeps/*'  -o -wholename '*/codecgen-*-1234.generated.go'  ) -prune  <del> ) -name '*.generated.go')) </del> <ins> ) -name '*.generated.go' | sort -r)) </ins> # Register function to be called on EXIT to remove codecgen # binary and also to touch the files that should be regenerated

file=${generated_files[$1]//.generated.go/.go} deps=$(go list -f "{{.Deps}}" ${file} | tr "[" " " | tr "]" " ") candidate=$(readlinkdashf "${generated_files[$2]//.generated.go/.go}") <del> result=false </del> for dep in ${deps}; do <del> if [[ ${candidate} = *${dep} ]]; then result=true </del> <ins> # Only look at dependencies within the kubernetes tree-- otherwise the "io" # package matches the end of one of our directories. if [[ ${dep} = "k8s.io"* ]]; then if [[ ${candidate} = *${dep} ]]; then echo true return fi </ins> fi done <del> echo ${result} </del> <ins> echo false </ins> } function tsort {

) -prune  ) -name '*.generated.go')) <del> # create a nice clean place to put codecgen there _tmpdir="$(mktemp -d -t codecgen.XXXXXX)" function cleanup { echo "Removing ${_tmpdir}" rm -rf "${_tmpdir}" } trap cleanup EXIT # Sort all files in the dependency order. number=${#generated_files[@]} for (( i=0; i<number; i++ )); do visited[${i}]=false </del> <ins> for generated_file in ${generated_files[@]}; do cat "${generated_file}" > "${generated_file}.original" </ins> done <del> result="" function depends { file=${generated_files[$1]//.generated.go/.go} deps=$(go list -f "{{.Deps}}" ${file} | tr "[" " " | tr "]" " ") candidate=$(readlinkdashf "${generated_files[$2]//.generated.go/.go}") result=false for dep in ${deps}; do if [[ ${candidate} = *${dep} ]]; then result=true fi done echo ${result} } function tsort { visited[$1]=true local j=0 for (( j=0; j<number; j++ )); do if ! ${visited[${j}]}; then if $(depends "$1" ${j}); then tsort $j fi fi done result="${result} $1" } for (( i=0; i<number; i++ )); do if ! ${visited[${i}]}; then tsort ${i} fi done index=(${result}) CODECGEN="${_tmpdir}/codecgen_binary" godep go build -o "${CODECGEN}" github.com/ugorji/go/codec/codecgen </del> <ins> ${KUBE_ROOT}/hack/update-codecgen.sh ret=0 </ins> # Generate files in the dependency order. <del> for current in ${index[@]}; do generated_file=${generated_files[${current}]} initial_dir=${PWD} file=${generated_file//.generated.go/.go} # codecgen work only if invoked from directory where the file # is located. pushd "$(dirname ${file})" > /dev/null base_file=$(basename "${file}") base_generated_file=$(basename "${generated_file}") # temporarily move the generated file to a non-go file so it doesn't influence the verify codecgen mv "${base_generated_file}" "${base_generated_file}.bak" # We use '-d 1234' flag to have a deterministic output every time. # The constant was just randomly chosen. ${CODECGEN} -d 1234 -o "${base_generated_file}.1tmp" "${base_file}" # Add boilerplate at the beginning of the generated file. sed 's/YEAR/2015/' "${initial_dir}/hack/boilerplate/boilerplate.go.txt" > "${base_generated_file}.tmp" cat "${base_generated_file}.1tmp" >> "${base_generated_file}.tmp" rm "${base_generated_file}.1tmp" # restore the generated file mv "${base_generated_file}.bak" "${base_generated_file}" ret=0 diff -Naupr -I 'Auto generated by' "${base_generated_file}" "${base_generated_file}.tmp" || ret=$? if [[ $ret -eq 0 ]]; then </del> <ins> for generated_file in ${generated_files[@]}; do cur=0 diff -Naupr -I 'Auto generated by' "${generated_file}" "${generated_file}.original" || cur=$? if [[ $cur -eq 0 ]]; then </ins> echo "${generated_file} up to date." else <del> echo "${generated_file} is out of date. Please run hack/update-codecgen.sh" exit 1 </del> <ins> echo "${generated_file} was out of date. Please run hack/update-codecgen.sh. (If you're running locally, this was run for you already.)" ret=1 </ins> fi <del> rm "${base_generated_file}.tmp" popd > /dev/null </del> <ins> rm -f "${generated_file}.original" </ins> done <ins> exit $ret </ins>