File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ exception_list=(
34
34
# Exclude the tools Dockerfile as otherwise the linter may need to be
35
35
# considered every time the Go version is updated.
36
36
" ./tools/Dockerfile"
37
+ " ./itest/backward-compat"
37
38
)
38
39
39
40
# is_exception checks if a file is in the exception list.
@@ -43,6 +44,13 @@ is_exception() {
43
44
if [ " $file " == " $exception " ]; then
44
45
return 0
45
46
fi
47
+
48
+ # Check if the file is inside an excluded directory.
49
+ # The trailing slash ensures that similarly named directories
50
+ # (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
51
+ if [[ " $file /" == " $exclude " * ]]; then
52
+ return 0
53
+ fi
46
54
done
47
55
return 1
48
56
}
Original file line number Diff line number Diff line change 63
63
64
64
target_go_version=" $1 "
65
65
66
+ # File paths to be excluded from the check.
67
+ exception_list=(
68
+ " ./itest/backward-compat"
69
+ )
70
+
71
+ # is_exception checks if a file is in the exception list.
72
+ is_exception () {
73
+ local file=" $1 "
74
+ for exception in " ${exception_list[@]} " ; do
75
+ if [ " $file " == " $exception " ]; then
76
+ return 0
77
+ fi
78
+
79
+ # Check if the file is inside an excluded directory.
80
+ # The trailing slash ensures that similarly named directories
81
+ # (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
82
+ if [[ " $file /" == " $exclude " * ]]; then
83
+ return 0
84
+ fi
85
+ done
86
+ return 1
87
+ }
88
+
66
89
# Search for YAML files in the current directory and its subdirectories.
67
90
yaml_files=$( find . -type f \( -name " *.yaml" -o -name " *.yml" \) )
68
91
69
92
# Check each YAML file.
70
93
for file in $yaml_files ; do
94
+ # Skip the file if it is in the exception list.
95
+ if is_exception " $file " ; then
96
+ echo " Skipping $file "
97
+ continue
98
+ fi
99
+
71
100
check_go_version_yaml " $file " " $target_go_version "
72
101
check_go_version_env_variable " $file " " $target_go_version "
73
102
done
You can’t perform that action at this time.
0 commit comments