Skip to content

x/mobile: gomobile install fails when using a vendor directory #22152

Closed
@ghost

Description

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.9 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux/amd64 (arch linux)

What did you do?

running gomobile install <package name> fails when using a vendor directory to manage deps with the following error:

gomobile: gitlab.com/stackmesh/network does not import "golang.org/x/mobile/app"

This has been tested for both the included x/mobile examples and custom projects.

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

https://play.golang.org/p/HMsmNBlfwJ
run glide init && glide update (should place a vendor dir in the project root),
run gomobile install <package name/gopath>

What did you expect to see?

The normal apk building messages and the upload logging.

What did you see instead?

gomobile: gitlab.com/stackmesh/network does not import "golang.org/x/mobile/app"

Activity

added this to the Unreleased milestone on Oct 5, 2017
changed the title x/mobile: x/mobile: gomobile install fails when using a vendor directory on Jan 6, 2018
aYosukeAkatsuka

aYosukeAkatsuka commented on Jan 15, 2018

@aYosukeAkatsuka

From https://github.com/golang/mobile/blob/master/cmd/gomobile/build.go#L137 ,

var nmRE = regexp.MustCompile(`[0-9a-f]{8} t (golang.org/x.*/[^.]*)`)

This regex is used to lookup "golang.org/x/..." package from shared object generated by gomobile using nm, but I guess it is not consider the "golang/x/..." package is placed under vendor directory.
I don't see any reason why the package cannot be placed on vendor directory. I guess this should be like this to allow put them under vendor.

var nmRE = regexp.MustCompile(`[0-9a-f]{8} t .*(golang.org/x.*/[^.]*)`)

If it is acceptable change, I'll create CL. :)
Thanks!

eliasnaur

eliasnaur commented on Mar 15, 2018

@eliasnaur
Contributor

That seems like a reasonable change. Please send a CL.

eliasnaur

eliasnaur commented on Mar 16, 2018

@eliasnaur
Contributor

Dup of: #18903

gopherbot

gopherbot commented on Mar 22, 2018

@gopherbot
Contributor

Change https://golang.org/cl/102095 mentions this issue: cmd/gomobile: allow to put "golang.org/x/..." package under vendor

pankona

pankona commented on Mar 22, 2018

@pankona

@eliasnaur
Thank you for your comment!
I just sent a CL, please check it 💯

locked and limited conversation to collaborators on Mar 23, 2019
added 2 commits that reference this issue on Apr 10, 2021
1b88e90
12f5163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @eliasnaur@aYosukeAkatsuka@pankona@gopherbot

      Issue actions

        x/mobile: gomobile install fails when using a vendor directory · Issue #22152 · golang/go