サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
買ってよかったもの
blog.learngoprogramming.com
When I first started trying to understand the memory allocator of Go, it was maddening. Everything seemed like a mystical black box. As almost every technical wizardry is hidden beneath abstractions, you need to peel off those layers one by one to understand it. In this blog post, we will exactly do that. Do you want to learn everything about Go memory allocator? You’re reading the right article.
Read the previous posts of this series here: Part I and Part II. This one is more about tricks rather than gotchas of deferring.
#1 — Deferred nil funcIf a deferred func evaluates to nil, execution panics when the surrounding func ends, not when defer is called. Examplefunc() { var run func() = nil defer run() fmt.Println("runs") }Outputruns❗️ panic: runtime error: invalid memory address or nil pointer dereferenceWhy?Here, the func continues until the end, after that the deferred func will run and panic because it’s nil. Ho
Important: In this tutorial, you’ll learn how to use the enums without iota in the first section — After that, you’ll also learn about iota and the other helper tools as well after the first section. So, learn to crawl first, then walk then run! What is an Enum? ★An enum groups related constants together in one type. Example enums:Timezones: EST, CST…T-shirt Sizes: Small, Medium, LargeServer Statu
このページを最初にブックマークしてみませんか?
『Learn Go Programming』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く