简体   繁体   中英

Panic Related to Garbage Collector When Running Go Program

I installed a Go program from GitHub and when I run it, I get the error,

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.

It appears that there isn't much information related to this out there. I have zero experience coding in Go.

Any help is much appreciated. I'll be happy to provide any extra information you might need.

PS: The program I installed is metabignor and it was installed with go install github.com/j3ssie/metabigor@latest .

you can also upgrade assume-no-moving-gc by using go get -u go4.org/unsafe/assume-no-moving-gc to solve this problem.

the panic error is triggered by the library you imported.

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.")
}

as what the error said, you need to set this env var

ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.18

or, upgrade the go runtime to go1.19

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM