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

x/mobile: gomobile shouldn't suggest sudoing #9854

Closed
rakyll opened this issue Feb 12, 2015 · 14 comments
Closed

x/mobile: gomobile shouldn't suggest sudoing #9854

rakyll opened this issue Feb 12, 2015 · 14 comments

Comments

@rakyll
Copy link
Contributor

rakyll commented Feb 12, 2015

If the GOROOT directory is not writable, a sudo won't help because the user's GOPATH/bin and Go tool won't be in the root's PATH. We may suggest changing ownership/permissions temporarily.

@crawshaw
Copy link
Member

GOPATH/bin shouldn't matter for the init subcommand, but GOPATH is necessary. Perhaps we could recommend sudo -E? Though we should adjust the ownership of GOPATH/pkg/gomobile back to SUDO_USER when we are done.

@hyangah
Copy link
Contributor

hyangah commented Feb 12, 2015

-E doesn't seem to preserve PATH env.

sudo -E PATH=$PATH gomobile init

But more generally, if users has no permission for sudo, should the tool suggest manage their own goroot?

@rakyll
Copy link
Contributor Author

rakyll commented Feb 12, 2015

General rule is not to require sudo if sudo can be omitted. I don't see a reason we should run gomobile init as the root user.

@crawshaw
Copy link
Member

If you install go with apt-get, your GOROOT is only writable to root. I don't want users to install another copy of Go, as it will lead to confusion.

@adg
Copy link
Contributor

adg commented Feb 12, 2015

We should probably check that bootstrapping works with the go packages
provided by popular distros before going down this road.
The distros like to strip stuff out and break things. :-(

On 13 February 2015 at 08:16, David Crawshaw notifications@github.com
wrote:

If you install go with apt-get, your GOROOT is only writable to root. I
don't want users to install another copy of Go, as it will lead to
confusion.


Reply to this email directly or view it on GitHub
#9854 (comment).

@hyangah
Copy link
Contributor

hyangah commented Feb 13, 2015

what popular distros should we check?

btw I checked the instruction ins https://wiki.ubuntu.com/Go
and it gave me go1.2.1.

2015-02-12 18:44 GMT-05:00 Andrew Gerrand notifications@github.com:

We should probably check that bootstrapping works with the go packages
provided by popular distros before going down this road.
The distros like to strip stuff out and break things. :-(

On 13 February 2015 at 08:16, David Crawshaw notifications@github.com
wrote:

If you install go with apt-get, your GOROOT is only writable to root. I
don't want users to install another copy of Go, as it will lead to
confusion.


Reply to this email directly or view it on GitHub
#9854 (comment).


Reply to this email directly or view it on GitHub
#9854 (comment).

__

@rakyll
Copy link
Contributor Author

rakyll commented Feb 13, 2015

We should probably check that bootstrapping works with the go packages

Or we should motivate them to fix their distributions.

@nightlyone
Copy link
Contributor

I think it would be great to avoid having add-on repositories write to GOROOT on Linux. Just vet needs to be there for historic reasons, others could have been in the GOPATH instead.
Godoc could be in GOPATH, too.

If there is an actual requirement to add more things to GOROOT/pkg/tool, then perhaps adding the convention of GOPATH/pkg/tool (for each GOPATH element of course) starts looking attractive...

@adg
Copy link
Contributor

adg commented Feb 16, 2015 via email

@rakyll
Copy link
Contributor Author

rakyll commented Feb 19, 2015

@nightlyone,

We write to the GOROOT to bootstrap and make go tools targeting arm7 Android. Additional stuff (Android NDK tooling) is being written to GOPATH.

@crawshaw
Copy link
Member

I think we are in better shape now. The gomobile tool only suggests running an mv command as the super user if it is necessary. There is still the question of do distributions ship with functional GOROOTs or not, but the tool now requires Go 1.5, so it will not be relevant for a while.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title mobile: gomobile shouldn't suggest sudoing x/mobile: gomobile shouldn't suggest sudoing Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-mobile label Apr 14, 2015
@EtienneBruines
Copy link

Using version devel +aff7a57 Tue Jun 9 08:21:21 2015 it does indeed suggest a mv command, but that doesn't help:

  • the init process is stopped and does not resume;
    • it's not finished either - running gomobile install still says android toolchain partially installed
  • the same message/suggestion is given when the init is restarted manually - thus not advancing.

@tonyconstantinides
Copy link

I still getting gomobile: toolchain partially installed , run gomobile init
even after I have run gomobile. It thinks it needs to build for ios even though I only interested in Android while building on El Capitan on my Macbook pro. The Android setup occurred but it now thinks it needs to setup IOS as well for some reason.
This is happening on Go Beta 1.5 so looks like it was never fixed

@crawshaw
Copy link
Member

The gomobile tool no longer suggests sudoing as of https://golang.org/cl/11711. The simplified logic pushed all decisions about how to handle an unwritable GOROOT onto the go tool.

@tonyconstantinides I believe your issue is unrelated to this one. Please try using go get -u to make sure you have the latest gomobile tool, rm -rf on $GOPATH/pkg/gomobile, and then another gomobile init. If you see the same error message, please file a new issue along with the revision of the x/mobile repository you are using.

@golang golang locked and limited conversation to collaborators Jul 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants