Skip to content

gopherjs get: Does not work reliably. #270

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

Closed
dmitshur opened this issue Aug 15, 2015 · 8 comments
Closed

gopherjs get: Does not work reliably. #270

dmitshur opened this issue Aug 15, 2015 · 8 comments

Comments

@dmitshur
Copy link
Member

For example:

$ export GOPATH=/tmp/clean_empty_workspace
$ go get -u github.com/gopherjs/gopherjs
$ $GOPATH/bin/gopherjs get github.com/shurcooL/play/113
cannot find package "honnef.co/go/js/dom" in any of:
    /usr/local/go/src/honnef.co/go/js/dom (from $GOROOT)
    /tmp/clean_empty_workspace/src/honnef.co/go/js/dom (from $GOPATH)

On the other hand, using go get with js build tag works:

$ go get -d -tags=js github.com/shurcooL/play/113

Additionally, gopherjs get is missing -u flag and some others.

Proposed Solutions

The logic of go get is quite complicated, and it tends to move forward with each point release of Go.

I see clear value to have gopherjs build, gopherjs install that mimic those commands of go tool. gopherjs serve is also extremely useful. In constrast, gopherjs get seems completely unneeded because you can always use go get with -d and -tags=js, followed by gophers install to simulate what gopherjs get is expected to achieve:

# gopherjs get import/path
go get -d -tags=js import/path
gopherjs install import/path

At this time, I think the best solution to this issue is to remove gopherjs get command. It will mean less maintenance and I think it's simpler for users.

Alternatives are:

  • Make gopherjs get work more reliably by shelling out to go get (should be quite easy).
  • Do all the work of fixing the problems/missing features in source code (would be quite hard IMO, and require much more future maintenance).
@flimzy
Copy link
Member

flimzy commented Sep 13, 2015

Would it be an option to simply have 'gopherjs get' execute 'go get -d tags=js'?

The only advantage, of course, is that 'gopherjs get' is easier to remember.

@dmitshur
Copy link
Member Author

Yes, that's the alternative 1 that I mentioned:

Make gopherjs get work more reliably by shelling out to go get (should be quite easy).

@dmitshur
Copy link
Member Author

The only advantage, of course, is that 'gopherjs get' is easier to remember.

For me, it's easier to remember go get -d -tags=js because I use go command often and I know all of its flags and behaviors (and they're super easy to lookup at golang.org/cmd/go).

Having to remember what gopherjs get does exactly would not be advantageous. Maybe other people have a different opinion.

@neelance
Copy link
Member

gopherjs get IS currently shelling out:
exec.Command("go", append([]string{"get", "-d"}, pkgs...)...)
Probably only -tags=js is missing.

@dmitshur
Copy link
Member Author

I see. That should indeed fix the main problem I've reported, but what about the additional ones, like:

Additionally, gopherjs get is missing -u flag and some others.

@neelance
Copy link
Member

We can also pass those through to the go command.

@neelance
Copy link
Member

gopherjs get is for convenience. It now does exactly what you described above:

# gopherjs get import/path
go get -d -tags=js import/path
gopherjs install import/path

I see no reason to remove it, it's just a few lines of code, nothing fancy. If someone needs more flags, then it's probably best to just fall back to the separate commands. Do you think we need to make this option more obvious?

@dmitshur
Copy link
Member Author

If someone needs more flags, then it's probably best to just fall back to the separate commands. Do you think we need to make this option more obvious?

I think the help/usage string for gopherjs get should say exactly that.

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

No branches or pull requests

3 participants