@@ -127,20 +127,26 @@ var walkFn = func(path string, info os.FileInfo, err error) error {
127
127
dir := filepath .Dir (path )
128
128
// true if the file is a symlink
129
129
if info .Mode ()& os .ModeSymlink != 0 {
130
- // assume symlink from old KEP location to new
131
- newLocation , err := os .Readlink (path )
132
- if err != nil {
133
- return err
134
- }
130
+ // Assume symlink from old KEP location to new. The new location
131
+ // will be processed separately, so no need to process it here.
132
+ return nil
133
+ }
135
134
136
- files = append (files , filepath .Join (dir , filepath .Dir (newLocation ), kepMetadata ))
135
+ metadataFile := filepath .Join (dir , kepMetadata )
136
+ if _ , err := os .Stat (metadataFile ); err == nil {
137
+ // There is kep metadata file in this directory, only that one should be processed.
138
+ if info .Name () == kepMetadata {
139
+ files = append (files , metadataFile )
140
+ }
137
141
return nil
138
142
}
139
143
140
144
if ignore (dir , info .Name ()) {
141
145
return nil
142
146
}
143
147
148
+ // TODO(#2220): Return an error as soon as all KEPs are migrated to directory-based
149
+ // KEP format.
144
150
files = append (files , path )
145
151
return nil
146
152
}
@@ -149,21 +155,12 @@ var walkFn = func(path string, info os.FileInfo, err error) error {
149
155
// TODO: Is this a duplicate of the package function?
150
156
// ignore certain files in the keps/ subdirectory
151
157
func ignore (dir , name string ) bool {
152
- if dir == "../keps/NNNN-kep-template" {
153
- return true // ignore the template directory because its metadata file does not use a valid sig name
154
- }
155
-
156
- if name == kepMetadata {
157
- return false // always check metadata files
158
- }
159
-
160
158
if ! strings .HasSuffix (name , "md" ) {
161
159
return true
162
160
}
163
161
164
162
if name == "0023-documentation-for-images.md" ||
165
163
name == "0004-cloud-provider-template.md" ||
166
- name == "YYYYMMDD-kep-template.md" ||
167
164
name == "README.md" ||
168
165
name == "kep-faq.md" {
169
166
return true
0 commit comments