![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
GO
痛苦鸭嘴笔
奋力想做到学术与工作两开花的年轻人
展开
-
Golang sort.Slice排序结果乱序问题
Golang的sort包提供了强大的切片排序功能,sort.Ints可以直接对int切片排序,sort.Slice可以自定义比较函数对任意切片排序,sort.Sort可以通过实现Len,Less,Swap三个接口实现更底层的自定义排序。一般来说使用sort.Slice就足够了。比如这一题,国王游戏,https://www.luogu.com.cn/problem/P1080,虽然难点在高精度,但高...原创 2020-02-05 18:31:45 · 1497 阅读 · 0 评论 -
马拉车算法
https://blog.csdn.net/Charles_Zaqdt/article/details/79747073转载 2019-11-26 16:23:08 · 112 阅读 · 0 评论 -
Go语言细节摘录
defer并不延迟函数的参数本身的调用 func trace(s string) string { fmt.Println("entering:", s) return s}func un(s string) { fmt.Println("leaving:", s)}func a() { defer un(trace("a")) fmt...原创 2019-11-15 15:02:50 · 242 阅读 · 0 评论 -
golang基于tls包生成tls配置
func generateTLSConfig() *tls.Config { key, err := rsa.GenerateKey(rand.Reader, 1024) if err != nil { panic(err) } template := x509.Certificate{SerialNumber: big.NewInt(1)} certDER, err := x50...原创 2019-11-11 20:52:37 · 2302 阅读 · 0 评论 -
Go MD5加密解密用法
加密过程func GetAuthKey(token string, timestamp int64) (key string) { token = token + fmt.Sprintf("%d", timestamp) md5Ctx := md5.New() md5Ctx.Write([]byte(token)) data := md5Ctx.Sum(nil) ...原创 2019-11-10 19:17:47 · 3123 阅读 · 0 评论 -
GO语言基础——1.变量与常量
标识符与关键词 变量 常量 标识符由字母数字下划线组成,不能含有其他特殊字符,只能以字母或下划线开头,不能以数字开头。关键字不能用作标识符,保留字可以用作标识符,但是不推荐用!25个关键字: break default func interface select case ...原创 2019-09-29 15:03:31 · 149 阅读 · 0 评论 -
GO语言基础——2.数据类型
1.整形类型 描述 uint8 无符号 8位整型 (0 到 255) uint16 无符号 16位整型 (0 到 65535) uint32 无符号 32位整型 (0 到 4294967295) uint64 无符号 64位整型 (0 到 18446744073709551615) int8 有符号 8位整型 (-128 到 127) ...原创 2019-09-30 15:58:34 · 130 阅读 · 0 评论