-
Notifications
You must be signed in to change notification settings - Fork 570
proposal: Replace in-house implementation of gopherjs
build tool with augmented forked cmd/go
build tool.
#388
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
Comments
gopherjs
build tool with augmented forked cmd/go
build tool.
I only have one concern: Should our forked command still be called "go"? That is, do we expect people who work with both Go and GopherJS to use our fork exclusively? That might encounter some resistance. Maybe it's a good idea to name the tool something else ( Apart from that, 👍 to the idea of reusing the go tool. |
That's a valid concern. I think we should begin by keeping the external CLI the same - the command would still be named This proposal is primarily about changing the internal implementation details of the current That said, it definitely hints of the possibility and paves the way to being able to use the forked version as your primarily |
I support this, but agree that it should be a different name, so that developers can still run the safe and steady go tool. |
That's the plan. :) It will be called
Yep. That will require us to be confident in it, but also for the Go team to be able to accept it. It may or may not happen for some time, we'll see. First step is to create the new |
ok i did not understand the original intention then: ) |
I agree totally, but would add one item: I have been writing lots of tests in a GopherJS project lateley. I work in LiteIDE. In that Editor I can hit cmd+T to fun all the tests in the current package. I can "rewire" the command on a per session basis, but it would be nice if:
Could look at the js build tag and decide which compiler to use, so, from an editor's perspective, I could hit cmd+T from any Go or GopherJS package and it just worked. This would maybe even be possible with some kind of wrapper/preprocessor? |
I think the following optimization might be possible. When you specify
You could do:
Basically, I am currently unaware of other ways to simplify it. You'll still be able to use |
Yes, that would work. Or, it would make a fairly good experience. In LIteIDE you can switch environments, so you could have one with ... and from the shell I could use something like |
The real syscall package doesn't import bytes. This keeps the order in which stdlib packages must be built in for GopherJS consistent with the real standard library. Helps #388.
The real syscall package doesn't import bytes. This keeps the order in which stdlib packages must be built in for GopherJS consistent with the real standard library. Helps #388.
The real syscall package doesn't import bytes. This keeps the order in which stdlib packages must be built in for GopherJS consistent with the real standard library. Helps #388.
It was initially added to support Go language tests. See da075de#commitcomment-17247656. Remove it since it's no longer needed, and it's unlikely to be used. Helps #388.
Really looking forward to kicking the tires on this. |
DO NOT MERGE. This is a PR for review only, it's not in a mergable state because not all components are present. I want to break review of the final PR into smaller pieces, to make it more diffs smaller and manageable. This change rewrites tool.go to use the functionality of cmd/go with GopherJS compiler support added, which will be bundled here. Changes: - watch flag is removed. Supporting it is possible, but difficult at this time and it's hard to test it. It may be brought back later, or maybe it'll be decided that it's out of scope, and another tool can help with watching. With gopherjs serve command available, the need for -watch flag is greatly reduced. This is a mostly mechanical change, done by hand, so there's a chance for typos or other screw ups, forgetting flags, etc. This is what I want this review to catch. Helps #388.
I'm no longer actively working on this proposal, see #485 (comment) for full details. |
I'm going to remove the "Proposal Accepted" label from this to reflect current reality. The implementation effort I started was cancelled (see previous comment). The proposal plan was pretty specific to Go 1.6. By now, Go 1.9 is coming up, and there have been changes to split So, this proposal would need to re-evaluated before being accepted again. |
I'm going to close this now. No one is actively working on this. There've been many minor improvements to the
Which makes the benefit of switching much lower, while the risk and effort stays the same. As always, should the situation change, this can be re-opened and discussed further. |
The GopherJS project has developed the
gopherjs
tool. Its CLI mimics a lot of the commands thatgo
tool (import pathcmd/go
, in GOROOT) offers, in addition to one new commandserve
(see #268). However, it's missing some features of the realcmd/go
(see issues labeled cmd/go for some examples).Instead of continuing to develop and maintain the
gopherjs
tool ourselves, I propose we replace the custom implementation ofgopherjs
with a modified fork of the realcmd/go
that has 2 changes cherry-picked on top. All existing functionality would be preserved, gaining missing features, fixing bugs, and reducing overall maintenance cost. The only functionality that the currentgopherjs
tool offers butcmd/go
doesn't is theserve
command, and we will preserve it in some way (details to be determined).Plan
At a high level, my proposed plan is:
cmd/go
.cmd/go
that makes the command go-gettable.cmd/go
available and maintain it by simply taking the latest upstream code and rebasing the 2 cherry-picked changes on top.The end result will be a fully capable
cmd/go
-like command that will support compiling withGOARCH=js
set. It will be able togo run
andgo test
by setting-exec=node
. It will resolve all these issues and simplify original code that GopherJS project has to maintain.Research and viability
I have explored this idea recently by attempting to do this during a 48-hour Gopher Gala 2016 hackathon. The project, which was mostly me learning about how
cmd/go
is structured and works, can be seen here:https://github.com/gophergala2016/cmd-go-js#readme
It partially implements what I have described above, but not completely. Due to time constraints, I did not attempt to make changes to
gopherjs
binary and simply used it as it exists today. This allowed me to implementgo build
andgo run
, but not the other commands.To have all other features work as expected, the entire
toolchain
interface needs to be implemented correctly.You can read the README of the linked project for additional details and observations.
Mockup
Here's a mockup demonstrating how the new build tool for GopherJS would look like:
One possible simplification might be that setting
-compiler=gopherjs
explicitly won't be needed whenGOARCH=js
is already set. That would allow typed commands to be shorter.Summary
By implementing this plan, the end result is expected to:
cmd/go
build tool.cmd/go
will be much smaller than to keep developing and maintaininggopherjs
tool ourselves.go
tool should be more familiar and friendly to new people, since most Go developers are very familiar with thecmd/go
tool and its flags.I've discussed this plan with @neelance and agreed it sounds favorable. What's next is to attempt to execute it and ensure no major blocking issues come up.
The text was updated successfully, but these errors were encountered: