bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
9.18k stars 278 forks source link

Extend the buf registry sdk command to reverse versions into module and reference #3485

Open KenxinKun opened 2 days ago

KenxinKun commented 2 days ago

Feature

Today we can do:

$ buf registry sdk version --module=buf.build/connectrpc/eliza --plugin=buf.build/protocolbuffers/go
v1.33.0-20230913231627-233fca715f49.1

However we cannot do the reverse operation.

I am presented with the challenge that I want to use buf export for all the Go imports from the BSR in my go.mod file, for example:

go 1.23.0

require (
    buf.build/gen/go/acme/paymentapis/protocolbuffers/go v1.35.2-20220907172603-9a877cf260e1.1
)

I tried doing buf export buf.build/acme/paymentapis:main -o ./temp and it works with the latest, however if I try buf export buf.build/acme/paymentapis:9a877cf260e1 -o ./temp with the short sha it fails with resource not found.

Is there a way to get exactly the version in the go.mod?