Home RSS icon Posts RSS icon Microblog

2021-11-01 22:22:22

Today's Always Developing session that I've just published to YouTube, was one of those nice ones where I finally figured something out, well, hopefully.

Snippet Pixie: Next - Writing a D-Bus server and client in Go - Part 4 | Always Developing #77

I was really struggling with how to use the result of a function call in Go that returned an Interface type. In particular I wanted to use the returned dbus.BusObject as the receiver for a function, it just wasn't playing nice.

Then I figured out how to embed the dbus.BusObject into a custom type so that it inherited the interface via the underlying dbus.Object that is actually returned from the function.

I then went on to set up a custom Interface that my type adhered to, and even put it in a package so that any client application can use it to ensure all functions are implemented.

There's still a long way to go, lots to add to that interface in both client and server, and likely a bunch of refactors yet to come, but I'm very pleased with the way things are shaping up.


"2021-11-01 22:22:22" was published on November 1, 2021.