Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

go.mod: use carved out googleapis/apis sub module #144

Merged
merged 1 commit into from
Aug 5, 2023

Conversation

jchappelow
Copy link
Contributor

On the current main branch, I am unable to build with the following error:

../../../go/pkg/mod/google.golang.org/grpc@v1.56.2/status/status.go:35:2: ambiguous import: found package google.golang.org/genproto/googleapis/rpc/status in multiple modules:
	google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 (/home/jon/go/pkg/mod/google.golang.org/genproto@v0.0.0-20230410155749-daa745c078e1/googleapis/rpc/status)
	google.golang.org/genproto/googleapis/rpc v0.0.0-20230710151506-e685fd7b542b (/home/jon/go/pkg/mod/google.golang.org/genproto/googleapis/rpc@v0.0.0-20230710151506-e685fd7b542b/status)

See googleapis/go-genproto#1015 for the cause.

Several new submodules were carved out of the large genproto module, This is causing an ambiguous import. The resolution here is to use the newly carved out genproto/googleapis/api submodule.

$ go get -d google.golang.org/genproto@latest
go: upgraded google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 => v0.0.0-20230726155614-23370e0ffb3e
$ go mod tidy  # pulls in the new *module* google.golang.org/genproto/googleapis/api

"go build -v ./..." succeeds now.

@jchappelow
Copy link
Contributor Author

Sorry for the noise on release day. Just some more context @Yaiba:

This only becomes an issue when you need to use kwil-db with the current kwil-extensions.

For example, you are actively making edits in the kwil-extensions repo and you want to use that from kwil-db with a replace github.com/kwilteam/kwil-extensions => ../kwil-extensions in your go.work file.

Alternatively, if you simply update kwil-db's require on kwil-extensions:

# kwil-db
$ go get -d github.com/kwilteam/kwil-extensions@main
go: downloading github.com/kwilteam/kwil-extensions v0.0.0-20230727040522-1cfd930226b7
go: upgraded github.com/kwilteam/kwil-extensions v0.0.0-20230710163303-bfa03f64ff82 => v0.0.0-20230727040522-1cfd930226b7
$ go mod tidy
$ go build -v ./...
/home/jon/go/pkg/mod/google.golang.org/grpc@v1.56.2/status/status.go:35:2: ambiguous import: ...
...

The root of the issue is that kwil-db has this require in it's go.mod:

google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1

That is a revision of the genproto megamodule from April.

And kwil-extensions has:

google.golang.org/genproto/googleapis/rpc v0.0.0-20230710151506-e685fd7b542b

That is a itself a module, but that import path was only carved out as it's own submodule quite recently (after april), this that package is locate in two modules: (1) the old megamodule, and (2) it's own newer sub-module.

Again, only an issue if you are trying to use the main branch from both repos.

@brennanjl brennanjl force-pushed the genproto-googleapis-carveout branch from bc6d5d5 to 653ec6f Compare August 2, 2023 16:41
See googleapis/go-genproto#1015

Several new submodules were carved out of the large genproto module,
This is causing an ambiguous import. The resolution here is to use the
newly carved out genproto/googleapis/api submodule.

Also run go mod tidy.

"go build -v ./..." succeeds now.
@sonarcloud
Copy link

sonarcloud bot commented Aug 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@jchappelow
Copy link
Contributor Author

Gonna go ahead and merge this. It's a benign module update.

This is a fairly common issue when a required module decides to carve out a smaller submodule. I have been applying this diff every time I switch branches, otherwise I cannot build because my module cache is aware of the newer module after previously replacing the to the latest kwil-extensions repo.

@jchappelow
Copy link
Contributor Author

Mmmm, no I guess it can't merge it. :) Can we get this in?

Copy link
Contributor

@brennanjl brennanjl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@brennanjl brennanjl merged commit 8bd11ae into main Aug 5, 2023
3 checks passed
@brennanjl brennanjl deleted the genproto-googleapis-carveout branch August 5, 2023 02:06
@jchappelow
Copy link
Contributor Author

ty!

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

Successfully merging this pull request may close these issues.

None yet

3 participants