Open yangwawa0323 opened 2 years ago
It appears this problem stems from the Atlas app toolkit. Their collection operators using jinzhu gorm v1
Using this plugin, I occurs some incompatibility problems on gorm v2 version:
go get github.com/infobloxopen/atlas-app-toolkit@gorm_v2
and go install
in this repogo get github.com/infobloxopen/atlas-app-toolkit@gorm_v2
in your repo using the generated pb.goI met same problem results to two versions of gorm in our project go mod file. I finally resolve it by using latest version of code. The problem is, current code is not the release version (may be not stable? ). The latest version still keeps v1.1.2 (released 2022 and do not contains gorm v2). You need to go get latest commit manually by targeting to commit id:
go get github.com/infobloxopen/protoc-gen-gorm@cedaaf0105d2
It will be auto added to your go.mod file, mod's name will be: github.com/infobloxopen/protoc-gen-gorm v1.1.3-0.20230222001438-cedaaf0105d2
Make sure to do not use your v1.1.2 version, suggest to delete local protoc-gen-gorm@v1.1.2 repo.
cd
to the downloaded v1.1.3 repo, and run:
go install
Re-generate your .pb.go code by protoc xxx
It would be great to cut a v1.1.3 (or a v2) version so people don't have to do this manually
By using
protoc-gen-gorm
generated the *.pb.gorm.go file, the problem is my project of the protobuf service using the"gorm.io/gorm"
is v2 of the gorm project that is not compatible of the"github.com/jinzhu/gorm"
which is v1.After I change the alias
gorm1
of imported package to v2 in the generated code *.pb.gorm.go, the VS code raised a lot of error.