[英]Panic Related to Garbage Collector When Running Go Program
我從 GitHub 安裝了一個 Go 程序,當我運行它時,出現錯誤,
panic: Something in this program imports go4.org/unsafe/assume-no-moving-gc to declare that it assumes a non-moving garbage collector, but your version of go4.org/unsafe/assume-no-moving-gc hasn't been updated to assert that it's safe against the go1.18 runtime. If you want to risk it, run with environment variable ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.18 set. Notably, if go1.18 adds a moving garbage collector, this program is unsafe to use.
似乎沒有太多與此相關的信息。 我在 Go 的編碼經驗為零。
任何幫助深表感謝。 我很樂意提供您可能需要的任何額外信息。
PS:我安裝的程序是 metabignor,它是用go install github.com/j3ssie/metabigor@latest
。
您也可以使用go get -u go4.org/unsafe/assume-no-moving-gc
升級assume-no-moving-gc
來解決這個問題。
恐慌錯誤是由您導入的庫觸發的。
https://github.com/go4org/unsafe-assume-no-moving-gc/blob/main/untested.go
func init() {
dots := strings.SplitN(runtime.Version(), ".", 3)
v := runtime.Version()
if len(dots) >= 2 {
v = dots[0] + "." + dots[1]
}
if os.Getenv(env) == v {
return
}
panic("Something in this program imports go4.org/unsafe/assume-no-moving-gc to declare that it assumes a non-moving garbage collector, but your version of go4.org/unsafe/assume-no-moving-gc hasn't been updated to assert that it's safe against the " + v + " runtime. If you want to risk it, run with environment variable " + env + "=" + v + " set. Notably, if " + v + " adds a moving garbage collector, this program is unsafe to use.")
}
如錯誤所述,您需要設置此環境變量
ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.18
或者,將 go 運行時升級到 go1.19
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.