Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions scripts/check-go-version-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ exception_list=(
# Exclude the tools Dockerfile as otherwise the linter may need to be
# considered every time the Go version is updated.
"./tools/Dockerfile"
"./itest/backward-compat"
)

# is_exception checks if a file is in the exception list.
Expand All @@ -43,6 +44,13 @@ is_exception() {
if [ "$file" == "$exception" ]; then
return 0
fi

# Check if the file is inside an excluded directory.
# The trailing slash ensures that similarly named directories
# (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
if [[ "$file/" == "$exclude"* ]]; then
return 0
fi
done
return 1
}
Expand Down
29 changes: 29 additions & 0 deletions scripts/check-go-version-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,40 @@ fi

target_go_version="$1"

# File paths to be excluded from the check.
exception_list=(
"./itest/backward-compat"
)

# is_exception checks if a file is in the exception list.
is_exception() {
local file="$1"
for exception in "${exception_list[@]}"; do
if [ "$file" == "$exception" ]; then
return 0
fi

# Check if the file is inside an excluded directory.
# The trailing slash ensures that similarly named directories
# (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
if [[ "$file/" == "$exclude"* ]]; then
return 0
fi
done
return 1
}

# Search for YAML files in the current directory and its subdirectories.
yaml_files=$(find . -type f \( -name "*.yaml" -o -name "*.yml" \))

# Check each YAML file.
for file in $yaml_files; do
# Skip the file if it is in the exception list.
if is_exception "$file"; then
echo "Skipping $file"
continue
fi

check_go_version_yaml "$file" "$target_go_version"
check_go_version_env_variable "$file" "$target_go_version"
done
Expand Down
Loading