Resolve <HashMap<Vec<u8>...> FFI Rust/Go chaos #5

Closed
opened 2026-06-25 16:13:08 +00:00 by decentral1se · 3 comments
Owner

re: https://github.com/n0-computer/iroh-ffi/issues/248#issuecomment-4777541073

I have no real interest in patching uniffi-bindgen-go as that sound gnarly af. iroh isn't changing the v1 API, so that is out. I think the Correct Solution ™️ would be to just search/replace the generated output because it's such a small change at the end of the day.

Otherwise, the bindings appear to be working well: https://git.coopcloud.tech/decentral1se/iroh-go/src/branch/main/examples

re: https://github.com/n0-computer/iroh-ffi/issues/248#issuecomment-4777541073 I have no real interest in patching `uniffi-bindgen-go` as that sound gnarly af. `iroh` isn't changing the v1 API, so that is out. I think the Correct Solution ™️ would be to just search/replace the generated output because it's such a small change at the end of the day. Otherwise, the bindings appear to be working well: https://git.coopcloud.tech/decentral1se/iroh-go/src/branch/main/examples
Collaborator

I read the issue as stemming from []byte not being a valid map key, but we can use strings which are trivially convertible from []byte. What's the concrete thing that needs to be searched for? map[[]byte] -> map[string]? Go go sed!

I read the issue as stemming from []byte not being a valid `map` key, but we can use strings which are trivially convertible from []byte. What's the concrete thing that needs to be searched for? `map[[]byte]` -> `map[string]`? Go go `sed`!
Author
Owner

Yeh, that's it! However, trying to sed this on the iroh-go side turns into a major sidequest as the generated code as all sorts of references to Bytes in the naming of internal functions. For now, I'm just cheekily building from a fork which mangles HashMap<Vec<u8>,...> into HashMap<String,...> and then building stuff 🙃 I can document this as a known issue and hopefully it doesn't explode later 🙏

Yeh, that's it! However, trying to sed this on the `iroh-go` side turns into a major sidequest as the generated code as all sorts of references to `Bytes` in the naming of internal functions. For now, I'm just cheekily building from a fork which mangles `HashMap<Vec<u8>,...>` into `HashMap<String,...>` and then building stuff 🙃 I can document this as a known issue and hopefully it doesn't explode later 🙏
Author
Owner
* https://git.coopcloud.tech/decentral1se/iroh-go/src/commit/7162741cb0f15835bdd9a39ad4c004422021298c/iroh-go/Cargo.toml#L12 * https://github.com/decentral1se/iroh-ffi/commit/3e102569e1c348480416a9b05cf020760f607dfe
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: decentral1se/iroh-go#5