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

Import broken when using only androidpublisher/v3 #2543

Closed
CoreFloDev opened this issue Apr 24, 2024 · 6 comments · Fixed by #2560
Closed

Import broken when using only androidpublisher/v3 #2543

CoreFloDev opened this issue Apr 24, 2024 · 6 comments · Fixed by #2560
Assignees
Labels
needs more info This issue needs more information from the customer to proceed. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@CoreFloDev
Copy link

Hi,

I am using only google.golang.org/api/androidpublisher/v3 on my application to manage play store subscription. Since the v0.174.0 when the dependency to app engine was removed, I got import errors:

api          | 2024/04/24 13:32:12 Error while building:
api          |  go: downloading google.golang.org/api v0.176.1
api          | go: downloading golang.org/x/sync v0.7.0
api          | go: downloading cloud.google.com/go/auth v0.3.0
api          | go: downloading cloud.google.com/go/auth/oauth2adapt v0.2.2
api          | go: downloading cloud.google.com/go/compute v1.24.0
api          | go: downloading cloud.google.com/go v0.26.0
api          | /go/pkg/mod/cloud.google.com/go/[email protected]/internal/internal.go:31:2: ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules:
api          |  cloud.google.com/go v0.26.0 (/go/pkg/mod/cloud.google.com/[email protected]/compute/metadata)
api          |  cloud.google.com/go/compute/metadata v0.3.0 (/go/pkg/mod/cloud.google.com/go/compute/[email protected])

I don't get how to address that issue, the only workaround I have found to far is too keep cloud.google.com/go/compute v1.25.1 // indirect

Unfortunately it gets removed at every go work sync or go mod tidy as I don't use it on my module.

Is there a better solution?

Have a nice day,
Florent

@CoreFloDev CoreFloDev added priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue. labels Apr 24, 2024
@codyoss
Copy link
Member

codyoss commented Apr 24, 2024

I just made a new project with this code which builds without issue:

package main

import (
	"context"

	"google.golang.org/api/androidpublisher/v3"
)

func main() {
	ctx := context.Background()
	androidpublisher.NewService(ctx)
}

If you are using up-to-date dependencies here it should not be an issue. Please share your go.mod and/or upgrade cloud.google.com/go to latest. The version mentioned in your comment is from 2018.

@codyoss codyoss added the needs more info This issue needs more information from the customer to proceed. label Apr 24, 2024
@CoreFloDev
Copy link
Author

I don't get why it mention cloud.google.com/go

it is not required on the go.mod I have

go 1.22.2

require (
	github.com/99designs/gqlgen v0.17.45
	github.com/go-chi/chi/v5 v5.0.12
	github.com/go-webauthn/webauthn v0.10.2
	github.com/google/wire v0.6.0
	github.com/jackc/pgx/v5 v5.5.5
	github.com/nicksnyder/go-i18n/v2 v2.4.0
	github.com/vektah/gqlparser/v2 v2.5.11
	golang.org/x/net v0.24.0
	google.golang.org/api v0.176.1
)

require (
	cloud.google.com/go/auth v0.3.0 // indirect
	cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
	cloud.google.com/go/compute v1.25.1 // indirect
	cloud.google.com/go/compute/metadata v0.3.0 // indirect
	github.com/agnivade/levenshtein v1.1.1 // indirect
	github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
	github.com/felixge/httpsnoop v1.0.4 // indirect
	github.com/fxamacker/cbor/v2 v2.6.0 // indirect
	github.com/go-logr/logr v1.4.1 // indirect
	github.com/go-logr/stdr v1.2.2 // indirect
	github.com/go-webauthn/x v0.1.9 // indirect
	github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
	github.com/golang/protobuf v1.5.4 // indirect
	github.com/google/go-tpm v0.9.0 // indirect
	github.com/google/s2a-go v0.1.7 // indirect
	github.com/google/uuid v1.6.0 // indirect
	github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
	github.com/googleapis/gax-go/v2 v2.12.3 // indirect
	github.com/gorilla/websocket v1.5.0 // indirect
	github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
	github.com/jackc/pgpassfile v1.0.0 // indirect
	github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
	github.com/jackc/puddle/v2 v2.2.1 // indirect
	github.com/kr/text v0.2.0 // indirect
	github.com/mitchellh/mapstructure v1.5.0 // indirect
	github.com/rogpeppe/go-internal v1.11.0 // indirect
	github.com/russross/blackfriday/v2 v2.1.0 // indirect
	github.com/sosodev/duration v1.2.0 // indirect
	github.com/urfave/cli/v2 v2.27.1 // indirect
	github.com/x448/float16 v0.8.4 // indirect
	github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
	go.opencensus.io v0.24.0 // indirect
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
	go.opentelemetry.io/otel v1.24.0 // indirect
	go.opentelemetry.io/otel/metric v1.24.0 // indirect
	go.opentelemetry.io/otel/trace v1.24.0 // indirect
	golang.org/x/crypto v0.22.0 // indirect
	golang.org/x/mod v0.16.0 // indirect
	golang.org/x/oauth2 v0.19.0 // indirect
	golang.org/x/sync v0.7.0 // indirect
	golang.org/x/sys v0.19.0 // indirect
	golang.org/x/text v0.14.0 // indirect
	golang.org/x/tools v0.19.0 // indirect
	google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
	google.golang.org/grpc v1.63.2 // indirect
	google.golang.org/protobuf v1.33.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
)

@codyoss
Copy link
Member

codyoss commented Apr 25, 2024

Maybe try deleting your go.sum and run go mod tidy? Or try what I recommend above. If you can provide a minimum reproducer I may be able to help more but I copied your go.mod updated my code to:

import (
	"context"

	_ "github.com/99designs/gqlgen/handler"
	_ "github.com/go-chi/chi/v5"
	_ "github.com/go-webauthn/webauthn/webauthn"
	_ "github.com/google/wire"
	_ "github.com/jackc/pgx/v5"
	_ "github.com/nicksnyder/go-i18n/v2/i18n"
	_ "github.com/vektah/gqlparser/v2"
	_ "golang.org/x/net/http2"
	"google.golang.org/api/androidpublisher/v3"
)

func main() {
	ctx := context.Background()
	androidpublisher.NewService(ctx)
}

And ran go mod tidy && go build and everything still works fine

@CoreFloDev
Copy link
Author

I was able to reproduce in a smaller repository https://github.com/CoreFloDev/errorAndroidPublisher

@codyoss
Copy link
Member

codyoss commented Apr 25, 2024

It is not super clear to me why this is happening yet, but an easy workaround is to add the following to your go.mod: exclude cloud.google.com/go v0.26.0 and run go mod tidy

@CoreFloDev
Copy link
Author

Yes that works thanks!

gcf-merge-on-green bot pushed a commit that referenced this issue Apr 30, 2024
Force dependency on `cloud.google.com/go` main module to resolve ambiguity.

Fixes #2543
Updates #2559
gcf-merge-on-green bot pushed a commit that referenced this issue Apr 30, 2024
🤖 I have created a release *beep* *boop*
---


## [0.177.0](https://togithub.com/googleapis/google-api-go-client/compare/v0.176.1...v0.177.0) (2024-04-30)


### Features

* **all:** Auto-regenerate discovery clients ([#2548](https://togithub.com/googleapis/google-api-go-client/issues/2548)) ([32a5d10](https://togithub.com/googleapis/google-api-go-client/commit/32a5d10b1870bacb93fdf065e5ce7923c04039e8))
* **all:** Auto-regenerate discovery clients ([#2550](https://togithub.com/googleapis/google-api-go-client/issues/2550)) ([f9bf96d](https://togithub.com/googleapis/google-api-go-client/commit/f9bf96df3a9a7ee9eb5b4b01c60d50f4c70e45c9))
* **all:** Auto-regenerate discovery clients ([#2551](https://togithub.com/googleapis/google-api-go-client/issues/2551)) ([4418f5f](https://togithub.com/googleapis/google-api-go-client/commit/4418f5fc551ce9a1edda277ddf483f3dd596d9aa))
* **all:** Auto-regenerate discovery clients ([#2553](https://togithub.com/googleapis/google-api-go-client/issues/2553)) ([2f46e14](https://togithub.com/googleapis/google-api-go-client/commit/2f46e14ff3836ec2ed0e9b08c33b3ec3d29e707b))
* **all:** Auto-regenerate discovery clients ([#2556](https://togithub.com/googleapis/google-api-go-client/issues/2556)) ([fb153c0](https://togithub.com/googleapis/google-api-go-client/commit/fb153c030eb62f149abff30e6948ea1933a9034c))
* Reduce code size by 29% ([#2544](https://togithub.com/googleapis/google-api-go-client/issues/2544)) ([2f2505b](https://togithub.com/googleapis/google-api-go-client/commit/2f2505b83d909fafc4dcf24aff9bb6eb3b7333d7))


### Bug Fixes

* Split large compute file up ([#2546](https://togithub.com/googleapis/google-api-go-client/issues/2546)) ([1b6db6c](https://togithub.com/googleapis/google-api-go-client/commit/1b6db6c4446668599f8db8edda2dde85d7b6015d))
* Temp patch cloud.google.com/go ambiguity ([#2560](https://togithub.com/googleapis/google-api-go-client/issues/2560)) ([3eb92f1](https://togithub.com/googleapis/google-api-go-client/commit/3eb92f1acf25ec8ac4eeb0fa75dbb04a10db36e0)), refs [#2543](https://togithub.com/googleapis/google-api-go-client/issues/2543) [#2559](https://togithub.com/googleapis/google-api-go-client/issues/2559)

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
gcf-merge-on-green bot pushed a commit that referenced this issue Dec 10, 2024
I believe our dep cycle issues should have been fixed in #2907.
Verified issue in #2543 is fixed with this change.

Fixes: #2559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info This issue needs more information from the customer to proceed. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants