Closed julienrbrt closed 1 year ago
@julienrbrt this is a great suggestion. So the proposal is that we can have all generated types as submodules so it is easily imported by other libraries and you don't need to import unnecessary dependencies?
@julienrbrt this is a great suggestion. So the proposal is that we can have all generated types as submodules so it is easily imported by other libraries and you don't need to import unnecessary dependencies?
Exactly!
Makes sense. I will take a look at it. Thanks!
@julienrbrt I am trying to make types
as a module - https://github.com/coinbase/rosetta-sdk-go/pull/461- and I am guess I am running into chicken and egg problem. package is not published so I cannot use it in main repo but how can I publish without merging it? Curious if you have any idea how can this be resolved?
You need to use replace tags in all packages importing types until you tag types separately. Then in a subsequent PR you can remove these replace tags for the newly tagged version.
Basically, in the root go.mod you add:
require github.com/coinbase/rosetta-sdk-go/types v0.0.0
replace github.com/coinbase/rosetta-sdk-go/types => ./types
@julienrbrt I have created a new types module - https://pkg.go.dev/github.com/coinbase/rosetta-sdk-go/types - please feel free to use that. I will create client and server soon. Hopefully it simplifies bloated imports. Thanks for the suggestion.
Is your feature request related to a problem? Please describe.
rosetta-sdk-go
has many dependencies. Some are retracted and must not be used: e.g. https://github.com/advisories/GHSA-2chg-86hq-7w38 (c.f. https://github.com/coinbase/rosetta-sdk-go/pull/458). Having one go module oblige packages dependent onrosetta-sdk-go
to import all dependencies.Describe the solution you'd like In the Cosmos SDK, we import only auto-generated types (from
types
andserver
). However, because this is one go module, we are as well importing everything else. Creating ago.mod
for all auto-generated types would let developers keep their implementation minimal.Describe alternatives you've considered Currently, we've forked this repo: github.com/cosmos/rosetta-sdk-go and use it for https://github.com/cosmos/cosmos-sdk/tree/main/tools/rosetta.