Skip writing to unedited files

This commit is contained in:
Phani Teja Marupaka
2020-03-20 09:33:06 -07:00
parent ce2e685619
commit a36d5b76be
3 changed files with 197 additions and 2 deletions

View File

@@ -57,11 +57,13 @@ func (fs FieldSetter) Set(openAPIPath, resourcesPath string) (int, error) {
}
// Update the resources with the new value
inout := &kio.LocalPackageReadWriter{PackagePath: resourcesPath}
// Set NoDeleteFiles to true as SetAll will return only the nodes of files which should be updated and
// hence, rest of the files should not be deleted
inout := &kio.LocalPackageReadWriter{PackagePath: resourcesPath, NoDeleteFiles: true}
s := &setters2.Set{Name: fs.Name}
err := kio.Pipeline{
Inputs: []kio.Reader{inout},
Filters: []kio.Filter{kio.FilterAll(s)},
Filters: []kio.Filter{setters2.SetAll(s)},
Outputs: []kio.Writer{inout},
}.Execute()
return s.Count, err