1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-04 09:43:23 +02:00
opentelemetry-go/get_main_pkgs.sh
Krzesimir Nowak 7d301220a2 Automate getting the list of examples to build (and switch to go 1.13 to avoid module problems) (#246)
* automate building all the examples

the EXAMPLES variable was out of date - the stackdriver example wasn't
even built

let's automate it, so we don't need to remember about updating the
variable after adding a new example to the examples directory

* move jaeger example to example directory

this should be in the examples directory, so it can be built by the
make test during CI.

* switch to go 1.13

circle ci uses go 1.12 (which is the oldest 1.12 release) that
contains some bugs with module handling

let's switch to go 1.13.3, the latest go currently

* use a single valid revision of the project in go.mod files

this probably shouldn't be a problem since the switch to go 1.13 in
circle ci, but cleans up the mess and the use of bogus releases
2019-10-29 08:45:48 -07:00

23 lines
492 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
top_dir='.'
if [[ $# -gt 0 ]]; then
top_dir="${1}"
fi
p=$(pwd)
mod_dirs=()
mapfile -t mod_dirs < <(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
cd "${p}"
done