Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] detect gnu-sed #37306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ set -eu -o pipefail

mod_files=$(find . -type f -name "go.mod")

# Check if GNU sed is installed
GNU_SED_INSTALLED=false
if sed --version 2>/dev/null | grep -q "GNU sed"; then
GNU_SED_INSTALLED=true
fi

# Return the collector main core version
get_collector_version() {
collector_module="$1"
Expand All @@ -37,7 +43,7 @@ check_collector_versions_correct() {

# Loop through all the module files, checking the collector version
for mod_file in $mod_files; do
if [ "$(uname)" == "Darwin" ]; then
if [ "${GNU_SED_INSTALLED}" = false ]; then
sed -i '' "s|$collector_module [^ ]*|$collector_module $collector_mod_version|g" $mod_file
else
sed -i'' "s|$collector_module [^ ]*|$collector_module $collector_mod_version|g" $mod_file
Expand Down
Loading