-
Notifications
You must be signed in to change notification settings - Fork 570
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
How do I debug native packages? #367
Comments
Yeah, I know what you're talking about. The reason is that GopherJS only compiles if the source files or the GopherJS binary itself have a newer timestamp than the output file. This check currently does not include the |
Thanks for the |
@neelance, if you can tell me what files need to be embedded, and where they are used, I can look at making a PR. It's quite easy. |
@shurcooL The files here https://github.com/gopherjs/gopherjs/tree/master/compiler/natives are used here Line 149 in 6ed7594
|
I can get it started by making a PR that simply creates that VFS. Next step will be to use it in all appropriate places. |
An important question is where to place the virtual filesystem variable that will hold the native package data. I've noticed that the https://github.com/gopherjs/gopherjs/tree/master/compiler/natives directory itself is empty, there's no package there. All natives are in subdirectories. It seems attractive to create a package at the root and place the variable there, for example:
For generating the VFS for statically embedding it, it will complicate matters a little, since we'll want to include the entire If it's desirable to simplify that, then it can be done by placing the VFS variable elsewhere. Or moving the natives data. So that the entire directory can be embedded without having to filter out files. I'll make the PR so you can look it over, and let me know if you feel it's okay or too complex. |
Created #369, please take a look and tell me your thoughts. |
Any thoughts on this so far? |
I have a Go app that binds to three.js and would like to open up the Chrome dev console and poke around in all the generated JavaScript code to figure out what is going on. I found this thread description and apologize for hijacking the thread, but I can't seem to find any basics anywhere on looking around. For example, I have a global log.Printf("platformMesh=%#v", platformMesh) and all I get in the Chrome dev console is:
whereas I would really like to access the JavaScript object. I looked through the generated JavaScript code and I see things like Is there a collection of known best-practices for debugging gopherjs-generated JavaScript code? |
Try |
Awesome. Thanks, @neelance! |
That has been implemented in ab917e0, so I'd like to follow up. Is there anything else that needs to be done here? When I think about it, I'm not quite sure how that change helps this issue (but I haven't fully thought it out, I welcome comments). I think embedding natives into the Prior to that change, I did the following inside
Now that we have natives accessed through the VFS abstraction, what should the best approach be to make changes to natives and install them? Naively, I would do the following right now:
The So that brings me back to the question, is there a better way to make and test changes to natives other than |
In the comment above, which I posted in May, I asked:
Based on no replies, it sounds like there isn't. I've looked over this issue and don't see anything immediately actionable here – it looks like a question that has been mostly answered. In order to keep open issues more actionable, I'll close this. Feel free to re-open if needed. |
I'm trying to tinker with the GopherJS implementation of runtime.go, to flesh out the
Callers()
method, which is needed by a third party package I want to use.I'm having a heck of a time debugging, though. I haven't found the "secret sauce" to make my changes to GopherJS's
./compiler/natives/runtime/runtime.go
file effectual for my third-party packages.There must be a simple step I'm overlooking.
I've tried (within the gopherjs checkout):
This successfully updates the gopherjs binary, but doesn't seem to (always?) update the native packages.
In my third party package, I've attempted
But that also has no effect, as demonstrated by utterly breaking
runtime.go
by introducing obvious typos... But the tests still execute, with no compilation failure.Clues?
The text was updated successfully, but these errors were encountered: