TODO: We should update v2 to v3 before releasing panacea-core v3.x.x. We will probably be able to adapt a bot that Osmosis uses.
@inchori @audtlr24 @H4NLee
I'm adding details to help you reviewing this PR.
From the panacea-core point of view, adding v2 into go_package options doesn't make any difference.
But, let's imagine what will happen in panacea-oracle that contains proto files as below, without merging this PR.
This proto file, foo.proto, imports a consent.proto defined in panacea-core repo. This can be compiled to foo.pb.go without any error. Everything looks good. But, the problem is that the foo.pb.go will have an import statement as below.
// `foo.pb.go` in panacea-oracle repo
import (
types "github.com/medibloc/panacea-core/x/datadeal/types"
)
Then, Go compiler will raise an error: github.com/medibloc/panacea-core/x/datadeal/types package not found, because the panacea-core is released as v2.x.x. To resolve this issue, we have to import Go packages as github.com/medibloc/panacea-core/v2/x/....
Of course, it is prohibited to modify auto-generated *.pb.go file. The recommended way is putting v2 into go_package options in original proto files defined in panacea-core repo. This PR is for that.
If panacea-oracle imports proto files fixed by this PR, the foo.pb.go will be generated as below. Then, Go compiler won't complain anything.
// `foo.pb.go` in panacea-oracle repo
import (
types "github.com/medibloc/panacea-core/v2/x/datadeal/types"
)
To make proto files to be imported by proto files in other Go projects such as https://github.com/medibloc/panacea-oracle/pull/79#discussion_r1094239242, we should put
v2
intogo_package
options in our proto files. This practice can be found in Osmosis proto files.TODO: We should update
v2
tov3
before releasing panacea-core v3.x.x. We will probably be able to adapt a bot that Osmosis uses.@inchori @audtlr24 @H4NLee I'm adding details to help you reviewing this PR. From the panacea-core point of view, adding
v2
intogo_package
options doesn't make any difference. But, let's imagine what will happen in panacea-oracle that contains proto files as below, without merging this PR.This proto file,
foo.proto
, imports aconsent.proto
defined in panacea-core repo. This can be compiled tofoo.pb.go
without any error. Everything looks good. But, the problem is that thefoo.pb.go
will have an import statement as below.Then, Go compiler will raise an error:
github.com/medibloc/panacea-core/x/datadeal/types package not found
, because the panacea-core is released as v2.x.x. To resolve this issue, we have to import Go packages asgithub.com/medibloc/panacea-core/v2/x/...
. Of course, it is prohibited to modify auto-generated*.pb.go
file. The recommended way is puttingv2
intogo_package
options in original proto files defined in panacea-core repo. This PR is for that. If panacea-oracle imports proto files fixed by this PR, thefoo.pb.go
will be generated as below. Then, Go compiler won't complain anything.