decancer icon indicating copy to clipboard operation
decancer copied to clipboard

Go bindings

Open kkrypt0nn opened this issue 6 months ago • 8 comments

Hey there!

Just wanted to ask if there are some plans to have Go bindings as well?

Another question would be if you may consider adding into a built-in method a way to get the characters delta between the given string and the returned, cured, string. Currently have plans of doing it manually - but maybe something that people could benefit of as well.

Cheers and thanks for that project :D

kkrypt0nn avatar Jul 22 '25 20:07 kkrypt0nn

Hai Krypton! Didn't expect to see a familiar face here haha, haven't seen you in a long time! Thank you so much for the support! :heart:

Yeah, there were plans to create a Go binding, but back then I didn't have the Go skills to integrate it with my Rust crate through FFI (especially porting it across several platforms). Maybe soon!

For character delta, I feel like that would be a bit of a complex feature to implement, especially since I have unicode bidi implemented (this could exponentially get more complicated if you add in Arabic or Hebrew characters, since the library reads them from left-to-right).

null8626 avatar Jul 24 '25 04:07 null8626

Hey, I tried to get a Go binding working with cgo but I've been struggling with it on Windows (since it seems to depend on MinGW instead of MSVC). Working on this would take a lot of time. Considering I am busy right now, I'll work on this later. So be patient!

null8626 avatar Jul 24 '25 18:07 null8626

Hey there!

If you don't mind, I can try to test around some things based on what you've managed to do so far. I should have cgo working on my machine and VM.

Thank you for considering it :D

kkrypt0nn avatar Jul 24 '25 18:07 kkrypt0nn

No worries! :heart:

Can you try this? As per the readme:

$ git clone https://github.com/null8626/decancer.git --depth 1
$ cd decancer/bindings/go
$ sudo -E "PATH=$PATH" go generate
$ go test

null8626 avatar Jul 25 '25 11:07 null8626

go generate still requires Rust to be installed, but at least once you've built and installed it, you can use it in any Go project you want!

I tried to keep Rust away from the build process yesterday but I can't, as this would introduce dozens of prebuilt binaries to the repository, which would bloat it even further (Java's bindings.zip and WASM's decancer.wasm are already big enough for me).

null8626 avatar Jul 25 '25 11:07 null8626

As mentioned over on Discord, looks all good on macOS & Linux (Debian):

Image

kkrypt0nn avatar Jul 25 '25 15:07 kkrypt0nn

Thankiess!! ❤️

null8626 avatar Jul 25 '25 19:07 null8626

Oh by the way, don't forget to add defer cured.Close() after your err check, forgot to add it in my readme example haha!

null8626 avatar Jul 26 '25 03:07 null8626