mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #111131 from thockin/coverage-handle-relative-paths
Make coverage handle relative-path pkgs
This commit is contained in:
		@@ -606,8 +606,17 @@ kube::golang::outfile_for_binary() {
 | 
				
			|||||||
# Returns 0 if the binary can be built with coverage, 1 otherwise.
 | 
					# Returns 0 if the binary can be built with coverage, 1 otherwise.
 | 
				
			||||||
# NB: this ignores whether coverage is globally enabled or not.
 | 
					# NB: this ignores whether coverage is globally enabled or not.
 | 
				
			||||||
kube::golang::is_instrumented_package() {
 | 
					kube::golang::is_instrumented_package() {
 | 
				
			||||||
  kube::util::array_contains "$1" "${KUBE_COVERAGE_INSTRUMENTED_PACKAGES[@]}"
 | 
					  if kube::util::array_contains "$1" "${KUBE_COVERAGE_INSTRUMENTED_PACKAGES[@]}"; then
 | 
				
			||||||
  return $?
 | 
					    return 0
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  # Some cases, like `make kubectl`, pass $1 as "./cmd/kubectl" rather than
 | 
				
			||||||
 | 
					  # "k8s.io/kubernetes/kubectl".  Try to normalize and handle that.  We don't
 | 
				
			||||||
 | 
					  # do this always because it is a bit slow.
 | 
				
			||||||
 | 
					  pkg=$(go list -find "$1")
 | 
				
			||||||
 | 
					  if kube::util::array_contains "${pkg}" "${KUBE_COVERAGE_INSTRUMENTED_PACKAGES[@]}"; then
 | 
				
			||||||
 | 
					    return 0
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  return 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Argument: the name of a Kubernetes package (e.g. k8s.io/kubernetes/cmd/kube-scheduler)
 | 
					# Argument: the name of a Kubernetes package (e.g. k8s.io/kubernetes/cmd/kube-scheduler)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user