ZhangZhihui's Blog |
|
||
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 阅读全文
摘要:
func main() { fmt.Printf("math.MaxInt32: %d\n", math.MaxInt32) fmt.Printf("math.MinInt32: %d\n", math.MinInt32) var counter int32 = math.MaxInt32 coun 阅读全文
摘要:
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 # 阅读全文
摘要:
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 阅读全文
摘要:
The Go language maintainer has no strong convention about structuring a project in Go. However, one layout has emerged over the years: project-layout 阅读全文
摘要:
Here, WithPort returns a closure. A closure is an anonymous function that references variables from outside its body; in this case, the port variable. 阅读全文
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
|
Copyright © 2024 ZhangZhihuiAAA
Powered by .NET 9.0 on Kubernetes |