运行 Go 程序时与垃圾收集器相关的恐慌

分享于2023年03月01日 garbage-collection go 问答
【问题标题】:Panic Related to Garbage Collector When Running Go Program运行 Go 程序时与垃圾收集器相关的恐慌
【发布时间】:2023-02-16 04:53:12
【问题描述】:

我从 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 安装的。


【解决方案1】:

您也可以使用 go get -u go4.org/unsafe/assume-no-moving-gc 升级 assume-no-moving-gc 来解决这个问题。

【讨论】: