Demystifying function parameters in Go – Alex Edwards
My new book guides you through the start-to-finish build of a real world web application in Go — covering topics like how to structure your code, manage dependencies, create dynamic database-driven pages, and how to authenticate and authorize users securely. In this post we're going to talk about how (and why!) different types of function parameters behave differently in Go. If you're new (or even not-so-new) to Go, this can be a common source of confusion and questions. Why do functions generally mutate maps and slices, but not other data types? Why isn't my slice being mutated when I append to it in a function? Why doesn't assigning a new value to a pointer parameter have any effect outside the function? Once you understand how functions and the different Go types work, the answers to these kind of questions becomes clearer. You'll discover that Go's behavior consistently follows a few fairly straightforward rules, which I'll aim to highlight in this post. (If you just want the actio
Demystifying Function Parameters in Go- Alex Edwards Not sure how to structure your Go web application? My new book guides you through the start-to-finish build of a real world web application in Go — covering topics like how to structure your code, manage dependencies, create dynamic database-driven pages, and how to authenticate and authorize users securely . Take a look! In this post we're going to talk about how (and why!) different types of function parameters behave differently in Go. If you're new (or even not-so-new) to Go, this can be a common source of confusion and questions. Why do
Explore this link on the map →saved by
related reading
- Frequently Asked Questions (FAQ) - The Go Programming Languagego.dev
- sync package - sync - Go Packagespkg.go.dev
- Memory Allocation in Go | Melatoninghiant3223.github.io
- Go Slices: usage and internals - The Go Programming Languagego.dev
- Effective Go - The Go Programming Languagego.dev
- Go go-to guide · YourBasicyourbasic.org
- Pointers & errors | Learn Go with testsquii.gitbook.io
- References and Borrowing - The Rust Programming Languagedoc.rust-lang.org
- The Slice Type - The Rust Programming Languagedoc.rust-lang.org
- The Laws of Reflection - The Go Programming Languagego.dev
- A half-hour to learn Rustfasterthanli.me
- Go类型系统概述 -Go语言101gfw.go101.org