mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	verify-no-vendor-cycles: set up Go environment
This script relies on Go but doesn't set up the private Go environment (which ensures that the go command meets k/k's requirements). This fixes that. As a drive-by improvement, drop two unnecessary backslashes from regexes (before / which doesn't need to be escaped). Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
		@@ -27,6 +27,9 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export GO111MODULE=on
 | 
					export GO111MODULE=on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					kube::golang::verify_go_version
 | 
				
			||||||
 | 
					kube::golang::setup_env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
staging_repos=()
 | 
					staging_repos=()
 | 
				
			||||||
kube::util::read-array staging_repos < <(kube::util::list_staging_repos)
 | 
					kube::util::read-array staging_repos < <(kube::util::list_staging_repos)
 | 
				
			||||||
staging_repos_pattern=$(IFS="|"; echo "${staging_repos[*]}")
 | 
					staging_repos_pattern=$(IFS="|"; echo "${staging_repos[*]}")
 | 
				
			||||||
@@ -34,7 +37,7 @@ staging_repos_pattern=$(IFS="|"; echo "${staging_repos[*]}")
 | 
				
			|||||||
cd "${KUBE_ROOT}"
 | 
					cd "${KUBE_ROOT}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check for any module that is not main or staging and depends on main or staging
 | 
					# Check for any module that is not main or staging and depends on main or staging
 | 
				
			||||||
bad_deps=$(go mod graph | grep -vE "^k8s.io\/(kubernetes|${staging_repos_pattern})" | grep -E "\sk8s.io\/(kubernetes|${staging_repos_pattern})" || true)
 | 
					bad_deps=$(go mod graph | grep -vE "^k8s.io/(kubernetes|${staging_repos_pattern})" | grep -E "\sk8s.io/(kubernetes|${staging_repos_pattern})" || true)
 | 
				
			||||||
if [[ -n "${bad_deps}" ]]; then
 | 
					if [[ -n "${bad_deps}" ]]; then
 | 
				
			||||||
  echo "Found disallowed dependencies that transitively depend on k8s.io/kubernetes or staging modules:"
 | 
					  echo "Found disallowed dependencies that transitively depend on k8s.io/kubernetes or staging modules:"
 | 
				
			||||||
  echo "${bad_deps}"
 | 
					  echo "${bad_deps}"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user