Interoperability between Go and Python
The last thing that is important to note is that not only have we created the application in two languages, but we created two applications that can both understand the data serialized in addressbook.db
.
Say we serialized data with the Go application, like the following:
$ cd chapter7 $ go run . add --kind per --name John --email john.doe@gmail.com
We can list all the elements of chapter7/addressbook.db
with the Python CLI, like so:
$ cd chapter7 $ python ../chapter8/main.py list name: John last_updated: 03/26/2024 00:13:04 person { email: "john.doe@gmail.com" } -----------------------
Inversely, we can serialize data in Python:
$ cd chapter8 $ python main.py add --kind per --name John --email john.doe@gmail.com
We can also list the elements with the Go CLI:
$ cd chapter7 $ go build –o addressbook $ cd ../chapter8 $ ../chapter7/addressbook list name: John last_updated: 03/26/2024 00:16:34 person...