在 Go 語言中,標準庫沒有直接提供獲取 goroutine ID 的功能,因此,如果我們想在日誌中添加 goroutine ID,需要藉助一些非標準的方式來實現。方法 1: 通過第三方庫(如 github.com/petermattis/goid)github.com/petermattis/goid 是一個常用的第三方庫,它可以幫助我們獲取當前 goroutine 的 ID。我們可以通過它來實 ⌘ Read more
在 Go 語言中,標準庫沒有直接提供獲取 goroutine ID 的功能,因此,如果我們想在日誌中添加 goroutine ID,需要藉助一些非標準的方式來實現。方法 1: 通過第三方庫(如 github.com/petermattis/goid)github.com/petermattis/goid 是一個常用的第三方庫,它可以幫助我們獲取當前 goroutine 的 ID。我們可以通過它來實 ⌘ Read more