You've already forked opentelemetry-go
							
							
				mirror of
				https://github.com/open-telemetry/opentelemetry-go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	Build scripts: Replace mapfile with read loop for old bash versions (#1425)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
		| @@ -23,14 +23,19 @@ fi | ||||
|  | ||||
| p=$(pwd) | ||||
| mod_dirs=() | ||||
| mapfile -t mod_dirs < <(find "${top_dir}" -type f -name 'go.mod' -exec dirname {} \; | sort) | ||||
|  | ||||
| # Note `mapfile` does not exist in older bash versions: | ||||
| # https://stackoverflow.com/questions/41475261/need-alternative-to-readarray-mapfile-for-script-on-older-version-of-bash | ||||
|  | ||||
| while IFS= read -r line; do | ||||
|     mod_dirs+=("$line") | ||||
| done < <(find "${top_dir}" -type f -name 'go.mod' -exec dirname {} \; | sort) | ||||
|  | ||||
| for mod_dir in "${mod_dirs[@]}"; do | ||||
|     cd "${mod_dir}" | ||||
|     main_dirs=() | ||||
|     mapfile -t main_dirs < <(go list --find -f '{{.Name}}|{{.Dir}}' ./... | grep '^main|' | cut -f 2- -d '|') | ||||
|     for main_dir in "${main_dirs[@]}"; do | ||||
|         echo ".${main_dir#${p}}" | ||||
|     done | ||||
|  | ||||
|     while IFS= read -r line; do | ||||
|         echo ".${line#${p}}" | ||||
|     done < <(go list --find -f '{{.Name}}|{{.Dir}}' ./... | grep '^main|' | cut -f 2- -d '|') | ||||
|     cd "${p}" | ||||
| done | ||||
|   | ||||
		Reference in New Issue
	
	Block a user