When I run buf generate, get error:
proto/auth_service.proto:5:8:user.proto: does not exist
buf.gen.yaml:
version: v1
plugins:
- name: go
out: gen/go
opt:
- paths=source_relative
- name: go-grpc
out: gen/go
opt:
- paths=source_relative
- name: grpc-gateway
out: gen/go
opt:
- paths=source_relative
- generate_unbound_methods=true
- name: openapiv2
out: swagger-ui/gen/openapiv2/
The proto files are in proto/, there are only 2 file, 1 file import the other via:
import "user.proto";
So, how to fix this ?
After adding
buf.work.yaml:now it works.
To find 3rd party dependencies specified via
depsbuf.yamlinside the module, aka. the dir contain .proto files. It maybe a sub dir wherebuf.gen.yamlandbuf.work.yamlresides.buf.mdshould be put in the same dir withbuf.yaml, though it doesn't effect the build. It effects the doc on buf.build site.buf mod updateshould be within the dir wherebuf.yamlexists, or should specify the dir, e.gbuf mod update proto/.goland, install thebufplugin, to make the .proto files able to find thedepsin IDE, though it doesn't effects but the build itself.Refer