Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
www/pydio-cells: Fix build with Go 1.18
Backport fixes from upstream: https://github.com/modern-go/reflect2/tree/fix-go1.18
- Loading branch information
Serhii (Sergey) Kozlov
authored and
Serhii (Sergey) Kozlov
committed
Apr 16, 2022
1 parent
c0ed6e0
commit 705118f
Showing
4 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__above__118.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
+ } | ||
+} |
24 changes: 24 additions & 0 deletions
24
www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_go__below__118.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
+ } | ||
+} |
48 changes: 48 additions & 0 deletions
48
www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__link.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
17 changes: 17 additions & 0 deletions
17
www/pydio-cells/files/patch-vendor_github.com_modern-go_reflect2_unsafe__map.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |