摘要: 字符串高效拼接 常见方式:使用+ 使用fmt.Sprintf 效率比较高的: strings.Builder func builderConcat(n int, str string) string { var builder strings.Builder for i := 0; i < n; i 阅读全文
posted @ 2023-08-01 22:02 codestacklinuxer 阅读(25) 评论(0) 推荐(0)
摘要: 目前使用gout 作为http客户端, 处理数据时看到了respone数据解析。 首先看解析respone header数据: 目前看代码的核心设计逻辑: 1、创建一个Header = headerDecode{} 实例 2、调用实例的(h *headerDecode) Decode(rsp *ht 阅读全文
posted @ 2023-08-01 14:50 codestacklinuxer 阅读(62) 评论(0) 推荐(0)
摘要: 目前对于反射使用不是很熟悉,记录之 if val.Kind() == reflect.Interface { val = reflect.ValueOf(val.Interface()) } switch t := val.Kind(); t { case reflect.Uint, reflect 阅读全文
posted @ 2023-08-01 00:06 codestacklinuxer 阅读(38) 评论(0) 推荐(0)