title: How to avoid copying vendor proto dependencies on buf generate
body: <p>I am testing grpc-gateway and trying to figure out the best way to import dependencies in my grpc service. I have the following dir structure:</p>
  <pre><code>proto/
    api.proto
    api2.proto
  third_party/
    googleapis/
      google/
        api/
          http.proto
          annotations.proto
  buf.yaml
  buf.gen.yaml
  
  </code></pre>
  <p>buf.yaml config</p>
  <pre><code>version: v1beta1
  build:
    roots:
      - third_party/googleapis
      - third_party/grpc-gateway
      - proto
  </code></pre>
  <p>Two things</p>
  <ul>
  <li>As you noticed I am using <a href="https://buf.build/" rel="nofollow noreferrer">buf.build</a> to generate proto files (you can ignore this fact if you know a better way);</li>
  <li>I am not copying <code>googleapi</code> under proto files intentionally and would like to keep them separate somewhere. I know google recommends keeping everything under <code>proto</code> folder and just copying dependent files (like <code>google/api/annotations.proto</code>), but I am not a fan of copying dozens of dependencies into my source code if I can avoid that somehow.</li>
  </ul>
  <p>My question is, whenever I run <code>buf generate --path=./proto</code> (please notice path is set as a directory),  I get <code>googleapis</code> <code>pb.go</code> files copied under <code>proto/googleapis/</code> folder. I find it very annoying and cannot figure out what is wrong with my setup. If I specify every file directly, everything is fine (e.g. <code>buf generate --path=./proto/api.proto</code>), no third-party content is copied.</p>
  <p>Is there a way to ignore <code>third_party</code> folders on <code>buf generate</code> and if not is there a better way to manage grpc dependencies. Copying files into every grpc project directly does make any sense for me.</p>