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
deps
buf.yaml
inside the module, aka. the dir contain .proto files. It maybe a sub dir wherebuf.gen.yaml
andbuf.work.yaml
resides.buf.md
should 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 update
should be within the dir wherebuf.yaml
exists, or should specify the dir, e.gbuf mod update proto/
.goland
, install thebuf
plugin, to make the .proto files able to find thedeps
in IDE, though it doesn't effects but the build itself.Refer