摘要:
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
阅读(24)
推荐(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
阅读(27)
推荐(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
阅读(10)
推荐(0)
摘要:
The SOLID principles are a set of design guidelines that help developers write more maintainable, scalable, and testable code. First introduced by Rob
阅读全文
posted @ 2024-02-13 15:40
ZhangZhihuiAAA
阅读(29)
推荐(0)
摘要:
An interface should live on the consumer side in most cases. However, in particular contexts (for example, when we know—not foresee—that an abstractio
阅读全文
posted @ 2024-02-13 15:28
ZhangZhihuiAAA
阅读(14)
推荐(0)
摘要:
Code and project organization: #1: Unintended variable shadowing #2: Unnecessary nested code #3: Misusing init functions #4: Overusing getters and set
阅读全文
posted @ 2024-02-13 15:25
ZhangZhihuiAAA
阅读(29)
推荐(0)
摘要:
Common behavior Decoupling Restricting behavior Common behavior: Restricting behavior:The last use case we will discuss can be pretty counterintuitive
阅读全文
posted @ 2024-02-13 14:34
ZhangZhihuiAAA
阅读(17)
推荐(0)
摘要:
zzh@ZZHPC:~$ VBoxManage modifyvm zwin10 --vram 256 zzh@ZZHPC:~$ VBoxManage modifyvm zwin10 --vram 512 VBoxManage: error: Invalid VRAM size: 512 MB (mu
阅读全文
posted @ 2024-02-11 23:14
ZhangZhihuiAAA
阅读(57)
推荐(0)
摘要:
func main() { counter := 0 var str string for _, i := range []byte("foobar") { letterBin := fmt.Sprintf("%08b", i) fmt.Println(letterBin) str = str +
阅读全文
posted @ 2024-01-19 17:12
ZhangZhihuiAAA
阅读(10)
推荐(0)
posted @ 2024-01-17 16:26
ZhangZhihuiAAA
阅读(9)
推荐(0)