Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

go get fails because replace directives don't work #198

Closed
youngjoon-lee opened this issue Jul 22, 2021 · 6 comments · Fixed by #199
Closed

go get fails because replace directives don't work #198

youngjoon-lee opened this issue Jul 22, 2021 · 6 comments · Fixed by #199
Assignees
Milestone

Comments

@youngjoon-lee
Copy link
Contributor

youngjoon-lee commented Jul 22, 2021

When I try to go get the panacea-core, the following error occurs. It seems replace directives don't work. This issue was also presented in the starport repo.

go get github.com/medibloc/panacea-core/v2
go get: github.com/medibloc/panacea-core/v2@none updating to
	github.com/medibloc/panacea-core/v2@v2.0.1-a requires
	github.com/gogo/protobuf@v1.3.3: reading github.com/gogo/protobuf/go.mod at revision v1.3.3: unknown revision v1.3.3

But, I've seen that the cosmos-sdk is go-gettable even though it also has many replace keywords: https://github.com/cosmos/cosmos-sdk/blob/12e4be34fbd2414b10756997ca3769ebaaf6bdea/go.mod#L59.

It might be related to the #197 .

@youngjoon-lee youngjoon-lee added this to the v2.0.1 milestone Jul 22, 2021
@youngjoon-lee youngjoon-lee self-assigned this Jul 22, 2021
@youngjoon-lee
Copy link
Contributor Author

The go-getting cosmos-sdk also fails with the same error:

go get github.com/cosmos/cosmos-sdk
go get: github.com/cosmos/cosmos-sdk@v0.40.0 updating to
	github.com/cosmos/cosmos-sdk@v0.42.7 requires
	github.com/gogo/protobuf@v1.3.3: reading github.com/gogo/protobuf/go.mod at revision v1.3.3: unknown revision v1.3.3

@youngjoon-lee youngjoon-lee changed the title go get fails because the replace keyword doesn't work go get fails because replace directives don't work Jul 22, 2021
@youngjoon-lee
Copy link
Contributor Author

Jesus... Go guys have been complaining this issue for a long time: golang/go#30354 (comment)

@gyuguen
Copy link
Contributor

gyuguen commented Jul 23, 2021

Oops, well, do we have to turn the logic back?

@youngjoon-lee
Copy link
Contributor Author

youngjoon-lee commented Jul 23, 2021

I think we have no choice but to use replace directives as cosmos-sdk. Because the gogo/protobuf isn't being maintained anymore, the Cosmos team forked it as regen-network/protobuf. But they didn't change the Go package name by design. So, we have to use replace directives.

I'm thinking about some workarounds.

@youngjoon-lee
Copy link
Contributor Author

youngjoon-lee commented Jul 23, 2021

One workaround might be using replace directives as well in the project that requires medibloc/panacea-core.

module aaa.com/kk

go 1.16

require github.com/medibloc/panacea-core/v2 v2.0.1-a

replace google.golang.org/grpc => google.golang.org/grpc v1.33.2

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

But, they must keep in mind that the version of replaced packages must be upgraded when the panacea-core is upgraded.

@youngjoon-lee
Copy link
Contributor Author

youngjoon-lee commented Jul 23, 2021

One work-around might be using replace directives as well in the project that requires medibloc/panacea-core.

I found that the cosmos/gaia also uses this workaround for users who go-get cosmos/gaia, even though they don't compile proto files.
https://github.com/cosmos/gaia/blob/64ae891c9a77ea88e08d7c5056781388d6892e42/go.mod#L18

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants