---
# System prepended metadata

title: 採坑日記
tags: [Go]

---

# 採坑日記
https://ithelp.ithome.com.tw/articles/10219493
## vscode
https://www.cnblogs.com/davis12/p/14986350.html

## go 1.20有問題
https://github.com/golang/go/issues/58550

## len 長度超出
![](https://hackmd.io/_uploads/ByEwO-D33.png)
這個專有名詞 找不太到
防止+1會有問題

## []byte vs []rune

https://learnku.com/articles/23411/the-difference-between-rune-and-byte-of-go

## Sync.WaitGroup, why closer in a goroutine
https://stackoverflow.com/questions/34818798/sync-waitgroup-why-closer-in-a-goroutine

https://segmentfault.com/q/1010000018891011
## Goroutines with sync.WaitGroup end before last wg.Done()
https://stackoverflow.com/questions/43166750/goroutines-with-sync-waitgroup-end-before-last-wg-done

## Go 中的类型断言和类型转换的差别
https://learnku.com/go/t/52387

## gorotines in slice 
https://juejin.cn/post/6844904134592692231
使用lock開銷會比較大
建議使用使用 channel 串行化操作

## 面試
https://www.yuque.com/aceld/golang/ca6mdf

## 空结构体
https://segmentfault.com/a/1190000040799205

## nil map and slices
![](https://i.imgur.com/1fI63NJ.png)
## array更改原始
![](https://i.imgur.com/2SQ657W.png)
![](https://i.imgur.com/EPIS3UQ.png)
## 字串的長度
![](https://i.imgur.com/SqhYHGB.png)
![](https://i.imgur.com/ex93anB.png)
## String在“range”语句中的迭代值
![](https://i.imgur.com/E58jQj5.png)
![](https://i.imgur.com/f8Fjdz5.png)

## 被Defer的函数调用执行
![](https://i.imgur.com/hmXhVZF.png)

![](https://i.imgur.com/DDAnJSH.png)
解决这个问题的一个方法是把代码块写成一个函数
![](https://i.imgur.com/To2zKX8.png)

![](https://i.imgur.com/c7VoElV.png)


## go
![](https://i.imgur.com/90am1GI.png)
![](https://i.imgur.com/AYNUrO4.png)
![](https://i.imgur.com/mn2nwC7.png)

## 更新Map的值
![](https://i.imgur.com/KjKdHGw.png)
![](https://i.imgur.com/RuSXT8j.png)

###### tags: `Go`