ZhangZhihui's Blog  
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 78 下一页

2024年2月14日

摘要: Note that there’s an infinite number of real values between math.SmallestNonzeroFloat64 (the float64 minimum) and math.MaxFloat64 (the float64 maximum 阅读全文
posted @ 2024-02-14 21:31 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: func main() { fmt.Printf("math.MaxInt32: %d\n", math.MaxInt32) fmt.Printf("math.MinInt32: %d\n", math.MinInt32) var counter int32 = math.MaxInt32 coun 阅读全文
posted @ 2024-02-14 20:10 ZhangZhihuiAAA 阅读(26) 评论(0) 推荐(0) 编辑
 
摘要: A linter is an automatic tool to analyze code and catch errors. To understand why linters are important, let’s take one concrete example. In mistake # 阅读全文
posted @ 2024-02-14 17:16 ZhangZhihuiAAA 阅读(10) 评论(0) 推荐(0) 编辑
 
摘要: Documentation is an important aspect of coding. It simplifies how clients can consume an API but can also help in maintaining a project. In Go, we sho 阅读全文
posted @ 2024-02-14 16:22 ZhangZhihuiAAA 阅读(10) 评论(0) 推荐(0) 编辑
 
摘要: The Go language maintainer has no strong convention about structuring a project in Go. However, one layout has emerged over the years: project-layout 阅读全文
posted @ 2024-02-14 12:01 ZhangZhihuiAAA 阅读(16) 评论(0) 推荐(0) 编辑
 
摘要: Here, WithPort returns a closure. A closure is an anonymous function that references variables from outside its body; in this case, the port variable. 阅读全文
posted @ 2024-02-14 11:45 ZhangZhihuiAAA 阅读(6) 评论(0) 推荐(0) 编辑

2024年2月13日

摘要: Because the mutex is embedded, we can directly access the Lock and Unlock methods from the i receiver.We mentioned that such an example is a wrong usa 阅读全文
posted @ 2024-02-13 21:41 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: Go 1.18 adds generics to the language. In a nutshell, this allows writing code with types that can be specified later and instantiated when needed. On 阅读全文
posted @ 2024-02-13 19:05 ZhangZhihuiAAA 阅读(11) 评论(0) 推荐(0) 编辑
 
摘要: With Go 1.18, the predeclared type any became an alias for an empty interface; hence, all the interface{} occurrences can be replaced by any. If futur 阅读全文
posted @ 2024-02-13 17:12 ZhangZhihuiAAA 阅读(7) 评论(0) 推荐(0) 编辑
 
摘要: All in all, in most cases, we shouldn’t return interfaces but concrete implementations. Otherwise, it can make our design more complex due to package 阅读全文
posted @ 2024-02-13 16:12 ZhangZhihuiAAA 阅读(2) 评论(0) 推荐(0) 编辑
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 78 下一页