Original post


I’m trying to use a go library from my python project. For that, I need a ctypes equivalent to the arguments types. For example, for a string variable is quite straightforward and there are multiple examples online.

I simply use (from my python code):

class GoString(Structure):
    _fields_ = [("p", c_char_p), ("n", c_longlong)]

cmd_str = b"issue"
cmd = GoString(cmd_str, len(cmd_str))

BUT, for a variable of type map[string]string. I couldn’t figure it out. Does anyone has already mapped a map[string]string variable to python ctypes struct?