golang-interview
golang-interview copied to clipboard
Go语言面试题集
# 3.1 局部变量分配在栈上还是堆上? — Go语言面试宝典 1.0.0 documentation [https://go-interview.iswbm.com/c03/c03_01.html](https://go-interview.iswbm.com/c03/c03_01.html)
# 3.6 内存对齐、内存布局是怎么回事? — Go语言面试宝典 1.0.0 documentation [https://go-interview.iswbm.com/c03/c03_06.html](https://go-interview.iswbm.com/c03/c03_06.html)
Go 语言中不是可以直接使用 `a, b = b, a` 这种交换方式嘛,这个解释我就很迷惑。 
# 1.1 Go 中的 = 和 := 有什么区别? — Go语言面试宝典 1.0.0 documentation [https://go-interview.iswbm.com/c01/c01_01.html](https://go-interview.iswbm.com/c01/c01_01.html)
# 2.5 说说你对 Go 里的抢占式调度的理解 — Go语言面试宝典 1.0.0 documentation [https://go-interview.iswbm.com/c02/c02_05.html](https://go-interview.iswbm.com/c02/c02_05.html)
感觉解答是偷换了概念。 不可寻址和有没有*T是两个概念。 字符串: ```go package main import ( "fmt" "unsafe" ) func main() { var s *string fmt.Println(unsafe.Sizeof(s)) } ``` map的元素: 虽然map的元素不可以寻址,但是元素有自己的类型,比如`var m map[string]int`,虽然元素不可以寻址,但是显然存在`*int`这种类型。 常量: 常量不可寻址不代表常量的类型`T`没有对应`*T`类型。 包级函数: ```go package main...