Fix js.ValueOf() with map[string]interface{} under gopherjs - fixes #19#20
Fix js.ValueOf() with map[string]interface{} under gopherjs - fixes #19#20hajimehoshi merged 2 commits intogopherjs:masterfrom
Conversation
js/js_notwasm.go
Outdated
| case nil: | ||
| return Null() | ||
| case bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, unsafe.Pointer, string: | ||
| case bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, unsafe.Pointer, string, map[string]interface{}: |
There was a problem hiding this comment.
and []interface{}?
https://golang.org/pkg/syscall/js/?GOOS=js&GOARCH=wasm#ValueOf
|
Will add |
|
I've updated the commit with tests too! I've added a commit to fix a typo in the .travis.yml also which meant it was testing gopherjs not gopherwasm. I'm still not 100% sure travis is testing the pull request though rather than master. In .travis.yml there is the line Which seems to me it overwrites the already checked out pull request with master doesn't it? Or maybe it doesn't since this is outside GOPATH? 😕 |
|
Thank you for fixing! I didn't realize the misspelling :-)
This |
…gopherjs This means that gopherjs ValueOf supports the same types as supported by the wasm version. Add a test for js.ValueOf also. Fixes gopherjs#19
|
I've added I had to only have one item in the object as the order of the keys can vary, but I don't think that is a problem. Thanks for your explanation about the |
Right, that's a good point. I think the current test is totally fine. |
|
PS Thanks for a great project - it is very useful! I'm using it here https://gpython.org/ |
|
Thank you for your PR! Is that a Python interpreter in Go? Awesome work! |
It is! Not the full thing alas since too many modules are in C but the core is there :-) I was amazed that gopherjs just compiled it no fuss and it worked! (Well I found one bug in gopherjs (which I reported) but that is pretty minor! Try |
|
Cool! I tried but on GopherJS version, there were errors: EDIT: Ah ok, I understood this is the bug in GopherJS. |
I'm not 100% sure this is the right fix, but it seems to work!