buf generate failed: may find the wrong file location
Hi all: I'm using buf for a long time, thanks to all of you guys first, you did great job!
What version of protobuf and what language are you using? Protoc Version: 3.21.12
Language: Go
Buf Version: v1.5.0-v1.8.0 good, v1.9.0+ bad for me
What operating system (Linux, Windows, ...) and version? macOS Ventura 13.1 (ARM)
What did you do?
- Upgrade buf binary version from v1.5.0 into v1.9.0+(tried all of them,and didn't work correctly)
- Manually cleaned buf mod caches
buf generate- An error occurred
What did you expect to see Generate successfully What did you see instead?
Failure: lstat /Users/{me}/.cache/buf/v1/module/data/buf.build/googleapis/googleapis/783e4b5374fa488ab068d08af9658438/license/v1/license.proto: not a directory
license/v1/license.proto does not exist under 783e4b5374fa488ab068d08af9658438
Anything else we should know about your project / environment
I have a proto repository which contains 20+ grpc services, one of them named 'license', buf binary compiled all of them correctly before upgrade, which is tagged at 'v1.5.0'
What I tried:
- buf binary test: v1.9.0+
buf generatewill be failed - clean cache and regenerate: not work for me,
buf generateis still failed - buf mod update: update success,
buf generateis still failed - downgrade to 1.5.0--1.8.0: success
So I tagged buf binary at v1.8.0 for now. Warning showed when I generate codes the first time downgraded:
WARN Module "buf.build/googleapis/googleapis:783e4b5374fa488ab068d08af9658438" has invalid cache state: calculated digest "b3-hcFCg87bpXHNQCxiHX_O0mQwbtnjzbAJfn67keq9f5w=" does not match stored digest "b3-_gBFYlSqszGZv7x8W3c9k0-R-2Xfr_nS3OV4QYwdkQQ=". The cache will attempt to self-correct.
What I have:
I do have a service named licnese, and here's a piece of code:
//file path: proto/license/v1/license.proto
syntax = "proto3";
package license.v1;
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
option go_package = "git.{xxx}.com/ms-public/sdk-grpc/langs/go/pb/license/v1";
service LicenseService {
rpc GetAuthorizedOS(google.protobuf.Empty) returns (GetAuthorizedOSResponse) {
option (google.api.http) = {
get: "/license/v1/authorized_os"
};
}
// ...
}
// messages below does not use any google-packages
// ...
What I think:
- Is buf trying to find 'license/v1/license.proto' in googleapis?
- What does the WARN means? is buf(v1.9.0+) downloads wrong packages?
Hey @kettlecat6 ~I wasn't able to replicate this issue~. I have an example repo here that puts all of the files where you've described
├── buf.gen.yaml
├── buf.lock
├── buf.yaml
├── gen
│ └── proto
│ └── go
│ └── proto
│ └── license
│ └── v1
│ └── license.pb.go
└── proto
└── license
└── v1
└── license.proto
~I have run buf generate on both v1.8.0 v1.9.0 and v1.10.0 and they have all worked:~
buf --version
1.8.0
➜ buf-1723 git:(master) buf generate
buf --version
1.9.0
➜ buf-1723 git:(master) buf generate
buf --version
1.10.0
➜ buf-1723 git:(master) buf generate
~Would you be able to verify that this repo has all of the elements that is causing buf to fail for you?~
Edit: was able to replicate it. will bring back to team
Hi guys, any progress about this issue?
@joshcarp, I was looking to verify whether this is still reproducible with the latest version, but wasn't able to reproduce with either 1.26.1 or 1.9.0 with your repository. Was there an additional step necessary to reproduce?
Closing as we are unable to reproduce, but feel free to re-open if a reproduction can be provided with the latest version of buf!