[Libguestfs] [libnbd PATCH] golang: Bump minimum Go version to 1.17
Nir Soffer
nsoffer at redhat.com
Thu Aug 17 17:38:48 UTC 2023
On Tue, Aug 15, 2023 at 9:53 PM Eric Blake <eblake at redhat.com> wrote:
> On Mon, Aug 14, 2023 at 01:43:37PM -0500, Eric Blake wrote:
> > > > +++ b/golang/configure/test.go
> > > > @@ -25,8 +25,19 @@
> > > > import (
> > > > "fmt"
> > > > "runtime"
> > > > + "unsafe"
> > > > )
> > > >
> > > > +func check_slice(arr *uint32, cnt int) []uint32 {
> > > > + /* We require unsafe.Slice(), introduced in 1.17 */
> > > > + ret := make([]uint32, cnt)
> > > > + s := unsafe.Slice(arr, cnt)
> > > > + for i, item := range s {
> > > > + ret[i] = uint32(item)
> > > > + }
> > > > + return ret
> > > > +}
> > > >
> > >
> > > I'm not sure what is the purpose of this test - requiring the Go
> version is
> > > good
> > > enough since the code will not compile with an older version. EVen if
> it
> > > would,
> > > it will not compile without unsafe.Slice so no special check is needed.
>
> Turns out it does matter. On our CI system, Ubuntu 20.04 has Go
> 1.13.8 installed, and without this feature test, it compiled just fine
> (it wasn't until later versions of Go that go.mod's version request
> causes a compile failure if not satisfied).
>
How does it compile when unsafe.Slice is undefined?
Quick test with unrelated test app:
$ go build; echo $?
# cobra-test
./main.go:10:6: undefined: cmd.NoSuchMethod
1
Or you mean the compile test for configure works and we want to make
the configure test fail to compile?
https://gitlab.com/nbdkit/libnbd/-/jobs/4870816575
>
> But while investigating that, I also noticed that libvirt-ci just
> recently dropped all Debian 10 support in favor of Debian 12, so I'm
> working on updating ci/manifest.yml to match.
>
Sounds like a good idea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20230817/f8ab0be7/attachment.htm>
More information about the Libguestfs
mailing list