In Python, to format a string with a dictionary, one can simply do:
geopoint = {
'latitude': 41.123,
'longitude':71.091
}
print('{latitude} {longitude}'.format(**geopoint))
The output will be 41.123 71.091. How do I achieve the same keyword unpacking of maps for string formatting in Go?
EDIT: Sorry if this was unclear in the question, but what I want to do is, like in Python, provide the keys for the values inside the format string.
fmt.Sprintf("%f %f", geopoint["latitude"], geopoint["longitude"])or, if you really wanted, write your own function (possibly based onregexp.ReplaceAllStringFunc).