Closed
Description
Hello,
I am trying to transpile junegunn/fzf, a really really good fuzzy-finder written in Golang.
My main-Function looks like this:
package main
import (
"github.com/gopherjs/gopherjs/js"
"github.com/junegunn/fzf/src/algo"
"github.com/junegunn/fzf/src/util"
)
func main() {
js.Global.Set("fzf", map[string]interface{}{
"FuzzyMatchV2": algo.FuzzyMatchV2,
})
}
Calling fzf.FuzzyMatchV2(true, false, false, "Hello World", "aW", true, null)
leads to an error:
..js:1419 Uncaught Error: runtime error: cannot internalize util.Chars
The util.Chars-Struct looks like this:
type Chars struct {
slice []byte // or []rune
inBytes bool
trimLengthKnown bool
trimLength uint16
// XXX Piggybacking item index here is a horrible idea. But I'm trying to
// minimize the memory footprint by not wasting padded spaces.
Index int32
}
If you want to try it, use my fork of fzf, branch "gopherjs". There is a small change, which takes out some unix syscall dependencies, to make the build happen.
I cannot find out what is leading to this error. Any help is appreciated.
Thanks in advance.