摘要:
1.go 采用c 的err方法,但是容易产生大量的外部判断。 package killer import "fmt" type Book struct { Name string Price int Store int Member int } func clientExample() { book 阅读全文
摘要:
在 Go 中,可以使用类型为 map[T]bool 的映射来判断切片中是否包含某个元素。 例如,假设你想要判断整型切片 s 中是否包含元素 x。你可以这样做: // 声明一个名为 m 的映射,其中键的类型为 int,值的类型为 bool。 m := make(map[int]bool) // 将 s 阅读全文
摘要:
本文译自:How To Close Channels in Golang Elegantly。几天前,我写了一篇文章来说明golang中channel的使用规范。在reddit和HN,那篇文章收到了很多赞同,但是我也收到了下面几个关于Go channel设计和规范的批评: 在不能更改channel状 阅读全文
摘要:
close函数是用于关闭通道的。官方解释(摘自close函数源代码注释): The close built-in function closes a channel, which must be eitherbidirectional or send-only. It should be execu 阅读全文
摘要:
常见报错语句: select count(*),(floor(rand(0)*2)) x from information_schema.tables group by x;1.通过concat函数连接注入语句与floor(rand(0)*2)函数,实现将注入结果与报错信息回显的注入方式。 1.1 阅读全文