Closed insanitywholesale closed 1 year ago
Hi, thanks for the kind words! I think we should be able to use buf beta migrate-v1beta1
to do most of the work for us. I'd forgotten I hadn't updated this repo yet, I should get to it :).
I didn't even know such a command existed! Great to know it can be done more easily than what I previously thought
First off I'd like to thank you for your awesome work, this repository has been an incredibly valuable source for learning how to structure a gRPC project in Go that uses gRPC-gateway.
I started writing my own template last year to add a few more things that I wanted to be figured out when I want to write a new service and it can be found in this repository on gitlab (it's also mirrored here on github).
Currently, my
buf.yaml
andbuf.gen.yaml
look a lot like yours and there is alsowouldbe-buf.work.yaml
because it currently doesn't work if you try to upgrade or if you just follow the steps in the official tour.This led me to spend many evenings trying to troubleshoot it until I read a blog post that provided just enough details to figure out the issue. In this commit on a feature branch I discovered that there is indeed a way to upgrade to it although it's less than ideal.
In rough order:
.proto
files, put a simplebuf.yaml
with thedeps
key and then runbuf mod update
to create the lock filev1
,v2
and so on for different versions of the API, you need to do the above step seemingly for all directories until the repo root but I haven't done extensive testing. I had to do it in myprotos/
directory that has two subdirectories/packages calledv1
andv2
buf.work.yaml
can be justbuf.yaml
doesn't need thebuild
key so it can just have the necessaryname
,version
anddeps
, of course withversion
going fromv1beta1
tov1
(v1 is wherebuild
and consequentlybuild.root
was removed)buf mod update
at the root and thenbuf generate
which shouldn't result in any issuesThat's what worked for me, I hope this helps somewhat in case you were holding back from upgrading due to the inability for buf to pull in
.proto
dependencies or generate files properly. Let me know if there is any additional information I can provide in case you wish to update the waybuf
stuff is handled, otherwise feel free to close the issue, I just wanted to share my experience dealing with this problem and what I did to fix it.