Let's say i have a string like this:
key1=val1, key2=val2 (and so on)
I want to deserialize it into a struct (the type I defined in my code), just like we do with JSON or XML. Ofc one could write a decoder function, but I thought it may exist, because writing your own deserializer may take some time and before doing it I thought there could be Go's standard library way.
Don't know of a library to do what you're asking. But it's easy to work with a string like that. If there were just a few types of structs I needed to do that with, I'd use strings.Split(s, ", ") to create a slice of key=value strings, and then strings.Split(ss, "=") again on the pieces, if I wanted to write code quickly that didn't need to be efficient. Then run the key value through a switch statement and update the matching struct field.
If I wanted that to be super efficient, I'ld write a loop around the switch statement that reset two byte slices to each subsequent key and value and not bother creating slices of strings first.
On the other hand, if I wanted to write the code fast, and work with many types of structs, I'd modify the string to be legal JSON and then use the JSON Unmarshal() function. It would be quick to write, and the json.Unmarshal() error would tell you if you had missed anything.