草庐IT

kugutsumen

全部标签

go - 如何优雅或高效地将 map 写入 http.ResponseWriter

我想知道编写键值表的最优雅方式是什么编码映射到http.ResponseWriter。Respond(kvmap[string]string){forkey,value:=rangekv{fmt.Fprintf(a.w,"%s:%s\n",key,value)}}我必须遵循这种键值格式:Key-ValueFormEncodingAmessageinKey-Valueformisasequenceoflines.Eachlinebeginswithakey,followedbyacolon,andthevalueassociatedwiththekey.Thelineisterminat

go - 如何优雅或高效地将 map 写入 http.ResponseWriter

我想知道编写键值表的最优雅方式是什么编码映射到http.ResponseWriter。Respond(kvmap[string]string){forkey,value:=rangekv{fmt.Fprintf(a.w,"%s:%s\n",key,value)}}我必须遵循这种键值格式:Key-ValueFormEncodingAmessageinKey-Valueformisasequenceoflines.Eachlinebeginswithakey,followedbyacolon,andthevalueassociatedwiththekey.Thelineisterminat