-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_otel.sh
More file actions
executable file
·32 lines (23 loc) · 876 Bytes
/
update_otel.sh
File metadata and controls
executable file
·32 lines (23 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -euo pipefail
gomods=$(find . -maxdepth 4 -name 'go.mod' | grep -v tools)
for gomod in ${gomods}; do
cd "$(dirname "${gomod}")"
echo "=> Updating dependencies in ${gomod}"
OTEL_DEPS=$(grep -E '(github.com/open-telemetry/opentelemetry-collector|github.com/open-telemetry/opentelemetry-collector-contrib|go.opentelemetry.io/collector)' go.mod | grep -v '^\/\/' | awk '{print $1}' | sort -u || true)
if [ -n "${OTEL_DEPS}" ]; then
echo " Found OTel dependencies:"
echo "${OTEL_DEPS}" | sed 's/^/ /'
echo " Updating them..."
for pkg in ${OTEL_DEPS}; do
echo " go get ${pkg}@latest"
go get "${pkg}@latest"
done
echo " Running 'go mod tidy'..."
go mod tidy
else
echo " No OTel dependencies found."
fi
cd -
echo ""
done