Only read *.pbtxt files in api_def/*_api directories when generating Go API.

PiperOrigin-RevId: 344308260
Change-Id: I1563382acd8eda94f2b46f92d2957522e1d5b79e
This commit is contained in:
Anna R 2020-11-25 13:33:02 -08:00 committed by TensorFlower Gardener
parent a7eb0f4531
commit c498ad75dd

View File

@ -94,6 +94,9 @@ func updateAPIDefs(m *apiDefMap, dir string) error {
return err
}
for _, file := range files {
if file.IsDir() || !strings.HasSuffix(file.Name(), ".pbtxt") {
continue
}
data, err := ioutil.ReadFile(path.Join(dir, file.Name()))
if err != nil {
return fmt.Errorf("failed to read %q: %v", file.Name(), err)