How to convert interface{} to string?

前端 未结 3 878
暖寄归人
暖寄归人 2021-01-30 07:38

I\'m using docopt to parse command-line arguments. This works, and it results in a map, such as

map[:www.google.de :80 --help:false --ver         


        
3条回答
  •  礼貌的吻别
    2021-01-30 08:19

    You don't need to use a type assertion, instead just use the %v format specifier with Sprintf:

    hostAndPort := fmt.Sprintf("%v:%v", arguments[""], arguments[""])
    

提交回复
热议问题