You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 23, 2022. It is now read-only.
I saw your comment that you don't know why the result is an array. I think it's because the GO method has a dual return type: (output *js.Object, err error)
I'm very new to GO and gopherjs (in fact I found your repo after spending loo long spinning my wheels on trying to do this exact thing: build a HCL2 parser for node.js), but from what I have seen the convention in GO is that errors are not thrown but signaled using this dual-return type pattern. I suspect that if you changed the signature to:
then the result via JS would not be enclosed in an array. I would hope that there is a way to make the JS version throw the error using the gopherjs lib. If I get some more time, I may try some things out and make a PR, but for now I just wanted to mention this.
But, thanks for making this repo. I was about to give up hope.
I saw your comment that you don't know why the result is an array. I think it's because the GO method has a dual return type:
(output *js.Object, err error)I'm very new to GO and gopherjs (in fact I found your repo after spending loo long spinning my wheels on trying to do this exact thing: build a HCL2 parser for node.js), but from what I have seen the convention in GO is that errors are not thrown but signaled using this dual-return type pattern. I suspect that if you changed the signature to:
then the result via JS would not be enclosed in an array. I would hope that there is a way to make the JS version throw the error using the gopherjs lib. If I get some more time, I may try some things out and make a PR, but for now I just wanted to mention this.
But, thanks for making this repo. I was about to give up hope.