chore: restrict gapic proto find func to a dir
Some apis, mainly aiplatform, have nested helper types in subdir under the serivce proto defs. We only want to look at the files in the service dir to generate the gapic service.
@@ -279,19 +279,18 @@ func (g *GapicGenerator) microgen(conf *MicrogenConfig) error {
log.Println("microgen generating", conf.Pkg)
var protoFiles []string
- if err := filepath.Walk(g.googleapisDir+"/"+conf.InputDirectoryPath, func(path string, info os.FileInfo, err error) error {
+ inputDir := filepath.Join(g.googleapisDir, conf.InputDirectoryPath)
+ entries, err := os.ReadDir(inputDir)
if err != nil {
return err
}
+ for _, entry := range entries {
// Ignore compute_small.proto which is just for testing and would cause a collision if used in generation.
//
// TODO(noahdietz): Remove this when it is no longer needed.
- if strings.Contains(info.Name(), ".proto") && !strings.Contains(info.Name(), "compute_small.proto") {
- protoFiles = append(protoFiles, path)
+ if strings.Contains(entry.Name(), ".proto") && !strings.Contains(entry.Name(), "compute_small.proto") {
+ protoFiles = append(protoFiles, filepath.Join(inputDir, entry.Name()))
}
- return nil
- }); err != nil {
- return err
}
args := []string{"-I", g.googleapisDir,
