Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/scripts/update-golang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
set -e

VERSION=''

while getopts v: flag
do
case "${flag}" in
v) VERSION=${OPTARG};;
*) exit 1;;
esac
done

if [ -z "$VERSION" ]; then
echo "Error: VERSION is required"
echo "Usage: $0 -v <version>"
exit 1
fi

echo "Bumping Go version to $VERSION..."

# Determine the OS and set the sed function accordingly
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed_inplace() {
sed -i '' "$@"
}
else
# Linux
sed_inplace() {
sed -i "$@"
}
fi

# Update main go.mod
echo "Updating main go.mod..."
sed_inplace -E "s/^go [0-9]+\.[0-9]+.*/go $VERSION/" go.mod

# Update all module go.mod files
echo "Updating all module go.mod files..."
find . -name "go.mod" -type f -not -path "./go.mod" -exec bash -c 'sed_inplace() { if [[ "$OSTYPE" == "darwin"* ]]; then sed -i "" "$@"; else sed -i "$@"; fi; }; sed_inplace -E "s/^go [0-9]+\.[0-9]+\.[0-9]+/go '"$VERSION"'/g" "$1"' bash {} \;

echo ""
echo "✓ Successfully bumped golang version to $VERSION"
echo ""
14 changes: 1 addition & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -448,19 +448,7 @@ update-golang:
ifndef VERSION
$(error VERSION is required. Usage: make update-golang VERSION=1.24.11)
endif
@echo "Bumping Go version to $(VERSION)..."

# Update main go.mod
@echo "Updating main go.mod..."
@sed -i '' -E 's/^go [0-9]+\.[0-9]+.*/go $(VERSION)/' go.mod

# Update all module go.mod files
@echo "Updating all module go.mod files..."
@find . -name "go.mod" -type f -not -path "./go.mod" -exec sed -i '' -E 's/^go [0-9]+\.[0-9]+\.[0-9]+/go $(VERSION)/g' {} \;

@echo ""
@echo "✓ Successfully bumped golang version to $(VERSION)"
@echo ""
@./.github/workflows/scripts/update-golang.sh -v $(VERSION)

.PHONY: update-otel
update-otel:$(MULTIMOD)
Expand Down
Loading