git: 705118f35fb6 - main - www/pydio-cells: Fix build with Go 1.18

From: Serhii (Sergey) Kozlov <skozlov_at_FreeBSD.org>
Date: Sat, 16 Apr 2022 22:10:08 UTC
The branch main has been updated by skozlov:

URL: https://cgit.FreeBSD.org/ports/commit/?id=705118f35fb6c56d580721d34105c95993eb974d

commit 705118f35fb6c56d580721d34105c95993eb974d
Author:     Serhii (Sergey) Kozlov <skozlov@FreeBSD.org>
AuthorDate: 2022-04-16 22:07:35 +0000
Commit:     Serhii (Sergey) Kozlov <skozlov@FreeBSD.org>
CommitDate: 2022-04-16 22:09:53 +0000

    www/pydio-cells: Fix build with Go 1.18
    
    Backport fixes from upstream:
    https://github.com/modern-go/reflect2/tree/fix-go1.18
---
 ...github.com_modern-go_reflect2_go__above__118.go | 26 ++++++++++++
 ...github.com_modern-go_reflect2_go__below__118.go | 24 +++++++++++
 ...r_github.com_modern-go_reflect2_unsafe__link.go | 48 ++++++++++++++++++++++
 ...or_github.com_modern-go_reflect2_unsafe__map.go | 17 ++++++++
 4 files changed, 115 insertions(+)

diff --git a/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__above__118.go b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__above__118.go
new file mode 100644
index 000000000000..a5f30e6a87c6
--- /dev/null
+++ b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__above__118.go
@@ -0,0 +1,26 @@
+--- vendor/github.com/modern-go/reflect2/go_above_118.go.orig	2022-04-16 21:52:43 UTC
++++ vendor/github.com/modern-go/reflect2/go_above_118.go
+@@ -0,0 +1,23 @@
++//+build go1.18
++
++package reflect2
++
++import (
++	"unsafe"
++)
++
++// m escapes into the return value, but the caller of mapiterinit
++// doesn't let the return value escape.
++//go:noescape
++//go:linkname mapiterinit reflect.mapiterinit
++func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer, it *hiter)
++
++func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
++	var it hiter
++	mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj), &it)
++	return &UnsafeMapIterator{
++		hiter:      &it,
++		pKeyRType:  type2.pKeyRType,
++		pElemRType: type2.pElemRType,
++	}
++}
diff --git a/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__below__118.go b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__below__118.go
new file mode 100644
index 000000000000..f47f8687a646
--- /dev/null
+++ b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__below__118.go
@@ -0,0 +1,24 @@
+--- vendor/github.com/modern-go/reflect2/go_below_118.go.orig	2022-04-16 21:56:08 UTC
++++ vendor/github.com/modern-go/reflect2/go_below_118.go
+@@ -0,0 +1,21 @@
++//+build !go1.18
++
++package reflect2
++
++import (
++	"unsafe"
++)
++
++// m escapes into the return value, but the caller of mapiterinit
++// doesn't let the return value escape.
++//go:noescape
++//go:linkname mapiterinit reflect.mapiterinit
++func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) (val *hiter)
++
++func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
++	return &UnsafeMapIterator{
++		hiter:      mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj)),
++		pKeyRType:  type2.pKeyRType,
++		pElemRType: type2.pElemRType,
++	}
++}
diff --git a/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__link.go b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__link.go
new file mode 100644
index 000000000000..3775e509f697
--- /dev/null
+++ b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__link.go
@@ -0,0 +1,48 @@
+--- vendor/github.com/modern-go/reflect2/unsafe_link.go.orig	2022-04-16 22:01:31 UTC
++++ vendor/github.com/modern-go/reflect2/unsafe_link.go
+@@ -19,19 +19,13 @@ func typedslicecopy(elemType unsafe.Pointer, dst, src 
+ 
+ //go:linkname mapassign reflect.mapassign
+ //go:noescape
+-func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key, val unsafe.Pointer)
++func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer, val unsafe.Pointer)
+ 
+ //go:linkname mapaccess reflect.mapaccess
+ //go:noescape
+ func mapaccess(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) (val unsafe.Pointer)
+ 
+-// m escapes into the return value, but the caller of mapiterinit
+-// doesn't let the return value escape.
+ //go:noescape
+-//go:linkname mapiterinit reflect.mapiterinit
+-func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) *hiter
+-
+-//go:noescape
+ //go:linkname mapiternext reflect.mapiternext
+ func mapiternext(it *hiter)
+ 
+@@ -42,9 +36,21 @@ func ifaceE2I(rtype unsafe.Pointer, src interface{}, d
+ // If you modify hiter, also change cmd/internal/gc/reflect.go to indicate
+ // the layout of this structure.
+ type hiter struct {
+-	key   unsafe.Pointer // Must be in first position.  Write nil to indicate iteration end (see cmd/internal/gc/range.go).
+-	value unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go).
+-	// rest fields are ignored
++	key         unsafe.Pointer
++	value       unsafe.Pointer
++	t           unsafe.Pointer
++	h           unsafe.Pointer
++	buckets     unsafe.Pointer
++	bptr        unsafe.Pointer
++	overflow    *[]unsafe.Pointer
++	oldoverflow *[]unsafe.Pointer
++	startBucket uintptr
++	offset      uint8
++	wrapped     bool
++	B           uint8
++	i           uint8
++	bucket      uintptr
++	checkBucket uintptr
+ }
+ 
+ // add returns p+x.
diff --git a/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__map.go b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__map.go
new file mode 100644
index 000000000000..1e4699268cb7
--- /dev/null
+++ b/www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__map.go
@@ -0,0 +1,17 @@
+--- vendor/github.com/modern-go/reflect2/unsafe_map.go.orig	2022-04-16 22:00:28 UTC
++++ vendor/github.com/modern-go/reflect2/unsafe_map.go
+@@ -107,14 +107,6 @@ func (type2 *UnsafeMapType) Iterate(obj interface{}) M
+ 	return type2.UnsafeIterate(objEFace.data)
+ }
+ 
+-func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
+-	return &UnsafeMapIterator{
+-		hiter:      mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj)),
+-		pKeyRType:  type2.pKeyRType,
+-		pElemRType: type2.pElemRType,
+-	}
+-}
+-
+ type UnsafeMapIterator struct {
+ 	*hiter
+ 	pKeyRType  unsafe.Pointer