Re: [Libguestfs] [libnbd PATCH] golang: Bump minimum Go version to 1.17

2023-08-13 Thread Nir Soffer
On Sat, Aug 12, 2023 at 12:18 AM Eric Blake  wrote:

> Go 1.17 or newer is required to use unsafe.Slice(), which in turn
> allows us to write a simpler conversion from a C array to a Go object
> during callbacks.
>
> To check if this makes sense, look at
> https://repology.org/project/go/versions compared to our list in
> ci/manifest.yml, at the time I made this commit:
>
> Alpine 3.15: 1.17.10
> AlmaLinux 8: 1.19.10
> CentOS Stream 8: 1.20.4
> Debian 10: 1.11.6
> Debian 11: 1.15.15 (mainline), 1.19.8 (backports)
> Debian 12: 1.19.8
> Fedoar 36: 1.19.8
> FreeBSD Ports: 1.20.7
> OpenSUSE Leap 15.3: 1.16.3
> OpenSUSE Leap 15.4: 1.18.1
> Ubuntu 18.04: 1.18.1
>
> We previously required a minimum of 1.13 for module support, which
> means Debian 10 was already not supporting Go bindings.  OpenSUSE Leap
> 15.3 loses support, but is relatively old these days.  All other
> systems appear unaffected by this bump in requirements, at least if
> they can be configured to use developer backports.
>
> Suggested-by: Nir Soffer 
> Signed-off-by: Eric Blake 
> ---
>
> This replaces
> https://listman.redhat.com/archives/libguestfs/2023-August/032227.html
>
>  generator/GoLang.ml  |  8 
>  README.md|  2 +-
>  golang/configure/go.mod  |  4 ++--
>  golang/configure/test.go | 11 +++
>  golang/go.mod|  4 ++--
>  5 files changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/generator/GoLang.ml b/generator/GoLang.ml
> index 73df5254..55ff1b8a 100644
> --- a/generator/GoLang.ml
> +++ b/generator/GoLang.ml
> @@ -517,10 +517,10 @@ let
>
>  func copy_uint32_array(entries *C.uint32_t, count C.size_t) []uint32 {
>  ret := make([]uint32, int(count))
> -// See
> https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices
> -// TODO: Use unsafe.Slice() when we require Go 1.17.
> -s := (*[1 << 30]uint32)(unsafe.Pointer(entries))[:count:count]
>

We have another instance of this pattern in AioBuffer.Slice


> -copy(ret, s)
> +s := unsafe.Slice(entries, count)
> +for i, item := range s {
> +ret[i] = uint32(item)
> +}
>  return ret
>  }
>  ";
> diff --git a/README.md b/README.md
> index c7166613..8524038e 100644
> --- a/README.md
> +++ b/README.md
> @@ -105,7 +105,7 @@ ## Building from source
>  * Python >= 3.3 to build the Python 3 bindings and NBD shell (nbdsh).
>  * FUSE 3 to build the nbdfuse program.
>  * Linux >= 6.0 and ublksrv library to build nbdublk program.
> -* go and cgo, for compiling the golang bindings and tests.
> +* go and cgo >= 1.17, for compiling the golang bindings and tests.
>  * bash-completion >= 1.99 for tab completion.
>
>  Optional, only needed to run the test suite:
> diff --git a/golang/configure/go.mod b/golang/configure/go.mod
> index ce3e4f39..fcdb28db 100644
> --- a/golang/configure/go.mod
> +++ b/golang/configure/go.mod
> @@ -1,4 +1,4 @@
>  module libguestfs.org/configure
>
> -// First version of golang with working module support.
> -go 1.13
> +// First version of golang with working module support and unsafe.Slice.
>

"First version of golang with working module support" is not relevant for
1.17,
maybe "For unsafe.Slice"?


> +go 1.17
> diff --git a/golang/configure/test.go b/golang/configure/test.go
> index fe742f2b..a15c9ea3 100644
> --- a/golang/configure/test.go
> +++ 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.


> +
>  func main() {
> fmt.Println(runtime.Version())
>
> diff --git a/golang/go.mod b/golang/go.mod
> index fc772840..1b72e77d 100644
> --- a/golang/go.mod
> +++ b/golang/go.mod
> @@ -1,4 +1,4 @@
>  module libguestfs.org/libnbd
>
> -// First version of golang with working module support.
> -go 1.13
> +// First version of golang with working module support and unsafe.Slice.
> +go 1.17
> --
> 2.41.0
>
>
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] libnbd | Failed pipeline for master | 3b6bf865

2023-08-13 Thread GitLab


Pipeline #966273140 has failed!

Project: libnbd ( https://gitlab.com/nbdkit/libnbd )
Branch: master ( https://gitlab.com/nbdkit/libnbd/-/commits/master )

Commit: 3b6bf865 ( 
https://gitlab.com/nbdkit/libnbd/-/commit/3b6bf865cd43fd351e49b37d277e308c54aaac0f
 )
Commit Message: golang: If --disable-golang is used, make sure ...
Commit Author: Richard W_M_ Jones ( https://gitlab.com/rwmjones )


Pipeline #966273140 ( https://gitlab.com/nbdkit/libnbd/-/pipelines/966273140 ) 
triggered by Richard W_M_ Jones ( https://gitlab.com/rwmjones )
had 2 failed jobs.

Job #4864566701 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4864566701/raw )

Stage: builds
Name: x86_64-freebsd-13
Job #4864566702 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4864566702/raw )

Stage: builds
Name: x86_64-freebsd-current

-- 
You're receiving this email because of your account on gitlab.com.



___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] libnbd | Failed pipeline for master | 8709285b

2023-08-13 Thread GitLab


Pipeline #966102131 has failed!

Project: libnbd ( https://gitlab.com/nbdkit/libnbd )
Branch: master ( https://gitlab.com/nbdkit/libnbd/-/commits/master )

Commit: 8709285b ( 
https://gitlab.com/nbdkit/libnbd/-/commit/8709285b6b71eabd71241a3f9edf653f70efb705
 )
Commit Message: golang: Skip test using syscall.Select on BSDs
...
Commit Author: Richard W_M_ Jones ( https://gitlab.com/rwmjones )


Pipeline #966102131 ( https://gitlab.com/nbdkit/libnbd/-/pipelines/966102131 ) 
triggered by Richard W_M_ Jones ( https://gitlab.com/rwmjones )
had 2 failed jobs.

Job #4863977307 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4863977307/raw )

Stage: builds
Name: x86_64-freebsd-13
Job #4863977308 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4863977308/raw )

Stage: builds
Name: x86_64-freebsd-current

-- 
You're receiving this email because of your account on gitlab.com.



___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] libnbd | Failed pipeline for master | 7f3b61d0

2023-08-13 Thread GitLab


Pipeline #966081125 has failed!

Project: libnbd ( https://gitlab.com/nbdkit/libnbd )
Branch: master ( https://gitlab.com/nbdkit/libnbd/-/commits/master )

Commit: 7f3b61d0 ( 
https://gitlab.com/nbdkit/libnbd/-/commit/7f3b61d00f6dbc4ed3ad4232a68f3065109a9dcf
 )
Commit Message: podwrapper: Add --replace parameter

This allow...
Commit Author: Richard W_M_ Jones ( https://gitlab.com/rwmjones )


Pipeline #966081125 ( https://gitlab.com/nbdkit/libnbd/-/pipelines/966081125 ) 
triggered by Richard W_M_ Jones ( https://gitlab.com/rwmjones )
had 3 failed jobs.

Job #4863887877 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4863887877/raw )

Stage: builds
Name: aarch64-macos-13
Job #4863887876 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4863887876/raw )

Stage: builds
Name: x86_64-freebsd-current
Job #4863887875 ( https://gitlab.com/nbdkit/libnbd/-/jobs/4863887875/raw )

Stage: builds
Name: x86_64-freebsd-13

-- 
You're receiving this email because of your account on gitlab.com.



___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs