- Notifications
You must be signed in to change notification settings - Fork 12
playground: Add ability to fix imports via goimports.#31
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
dmitshur commented Sep 13, 2015
Ok, everything is done from my side and this is ready to merge. It can be squashed into fewer commits after review. PTAL. |
neelance commented Sep 14, 2015
What are the changes to the |
dmitshur commented Sep 14, 2015
From the PR description (with emphasis added):
You can visualize the diff with any tool by comparing the folders of this In summary, it removes some unused code (reducing the functionality to use in-memory pre-computed database of packages only, no falling back to reading from disk), and sets some internal configuration variables. Since those variables not exported, the upstream package cannot be directly used. One alternative I see is not removing the unused code, but copying the upstream funcinit(){// Override some internal funcs.importPathToName=importPathToNameBasicfindImport=findImportStdlib }Which would make the forked package a little easier to maintain, but it will have a lot of extra unused code and potentially still cause syscall errors.
The problem is that the One idea for how to resolve that upstream is to make a CL that makes the package friendly to such IO-less environments is to make use of the However, even if that happens, I've built a custom index including Go 1.5 standard library and Concluding noteI realize this is a lot of code and it seems hard to maintain. However, I've considered that, and I think it will not cause a lot of problems for these reasons:
|
…packages. Generate zstdlib.go, include Go 1.5, skip syscall. Use a modified version of cmd/api tool to include gopherjs/js package. Add go generate step for imports package to update.sh.
Add ability to turn off goimports. As suggested by @dominikh.
dmitshur commented Sep 14, 2015
I've squashed and rebased this PR into 4 logical commits, that should be easier to review, maintain and understand in the future. This has LGTM and is ready to merge from my side. |
playground/playground.go Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be a better angular way of accessing the value of a checkbox; I do not know what it is, so I just accessed the DOM directly.
dmitshur commented Sep 19, 2015
@neelance, will you have a chance to review this soon? It's ready to merge from my side. |
neelance commented Sep 19, 2015
I think it is reasonable to ask for |
Factor out []byte(scope.Get("code").String()) into a local variable. Rebuild playground.dmitshur commented Sep 19, 2015
I will try, but a few things:
I'll file an issue with the feature request. |
dmitshur commented Sep 19, 2015
Filed issue golang/go#12696. With that, I've addressed all your outstanding comments. PTAL. |
neelance commented Sep 20, 2015
LGTM :) |
playground: Add ability to fix imports via goimports.



Resolves#29.
This is a WIP, there are still a few things I want to clean up and do. Edit: All done.
gopherjs.com/gopherjs/gopherjs/jspackage in the pre-baked list.importspackage code to avoid reading from disk, because some private internal configuration had to be changed to make that work. Just want to confirm that's still the case.pkgIndexand causes syscall errors in browser environment.importspackage underinternalsubfolder. We probably don't want others to be importing it.However, it's functional and ready for initial review.