maxmind / mmdbwriter

Go library for writing MaxMind DB (mmdb) files
Apache License 2.0
116 stars 28 forks source link

Support go1.18 #32

Closed yugo-horie closed 2 years ago

yugo-horie commented 2 years ago

We are using this library for our geolocation converter. One day, the Ci of our converter failed suddenly with the bellowing messages.

$ ./mmdb ./testdata
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.
goroutine 1 [running]:
go4.org/unsafe/assume-no-moving-gc.init.0()
    /go/pkg/mod/go4.org/unsafe/assume-no-moving-gc@v0.0.0-2020[122](https://xxxxxxxxxxx/yyyyy/mmdb/-/jobs/64830#L122)2180813-1025295fd063/untested.go:24 +0x1f4

This mmdb command is just our converter to be built on a docker container which has been made by the image of golang/1.18

Using Docker executor with image golang:1.18 ...

We've investigated, found a similar issue, and fixed it with this patch. https://github.com/grafana/loki/issues/5875 https://github.com/grafana/loki/pull/6046

Moreover, This library's tests failed with the same messages at my localhost. Thus this library has certainly the above issue.

mmdbwriter % go test
go: downloading github.com/stretchr/testify v1.7.2
go: downloading github.com/davecgh/go-spew v1.1.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.1
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.

goroutine 1 [running]:
go4.org/unsafe/assume-no-moving-gc.init.0()
    /Users/yugo-horie/.go/pkg/mod/go4.org/unsafe/assume-no-moving-gc@v0.0.0-20201222180813-1025295fd063/untested.go:24 +0x1f4
exit status 2
FAIL    github.com/maxmind/mmdbwriter   0.352s

go version

mmdbwriter % go version
go version go1.18.3 darwin/amd64

After patching, we retest all tests that have failed, and it looks fine that.

% go test
PASS
ok      github.com/maxmind/mmdbwriter   0.513s

So we applied the compatibility issue for this library. Can you review and test this patch ASAP?

oschwald commented 2 years ago

Interesting. We are on Go 1.18 and have not experienced this issue.

oschwald commented 2 years ago

Thanks!