mirror of
https://github.com/stashapp/stash.git
synced 2025-12-08 17:35:40 +01:00
* Upgrade gqlgen to v0.17.2 This enables builds on Go 1.18. github.com/vektah/gqlparser is upgraded to the newest version too. Getting this to work is a bit of a hazzle. I had to first remove vendoring from the repository, perform the upgrade and then re-introduce the vendor directory. I think gqlgens analysis went wrong for some reason on the upgrade. It would seem a clean-room installation fixed it. * Bump project to 1.18 * Update all packages, address gqlgenc breaking changes * Let `go mod tidy` handle the go.mod file * Upgrade linter to 1.45.2 * Introduce v1.45.2 of the linter The linter now correctly warns on `strings.Title` because it isn't unicode-aware. Fix this by using the suggested fix from x/text/cases to produce unicode-aware strings. The mapping isn't entirely 1-1 as this new approach has a larger iface: it spans all of unicode rather than just ASCII. It coincides for ASCII however, so things should be largely the same. * Ready ourselves for errchkjson and contextcheck. * Revert dockerfile golang version changes for now Co-authored-by: Kermie <kermie@isinthe.house> Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
76 lines
2.6 KiB
Go
76 lines
2.6 KiB
Go
package reflect2
|
|
|
|
import "unsafe"
|
|
|
|
//go:linkname unsafe_New reflect.unsafe_New
|
|
func unsafe_New(rtype unsafe.Pointer) unsafe.Pointer
|
|
|
|
//go:linkname typedmemmove reflect.typedmemmove
|
|
func typedmemmove(rtype unsafe.Pointer, dst, src unsafe.Pointer)
|
|
|
|
//go:linkname unsafe_NewArray reflect.unsafe_NewArray
|
|
func unsafe_NewArray(rtype unsafe.Pointer, length int) unsafe.Pointer
|
|
|
|
// typedslicecopy copies a slice of elemType values from src to dst,
|
|
// returning the number of elements copied.
|
|
//go:linkname typedslicecopy reflect.typedslicecopy
|
|
//go:noescape
|
|
func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int
|
|
|
|
//go:linkname mapassign reflect.mapassign
|
|
//go:noescape
|
|
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)
|
|
|
|
//go:noescape
|
|
//go:linkname mapiternext reflect.mapiternext
|
|
func mapiternext(it *hiter)
|
|
|
|
//go:linkname ifaceE2I reflect.ifaceE2I
|
|
func ifaceE2I(rtype unsafe.Pointer, src interface{}, dst unsafe.Pointer)
|
|
|
|
// A hash iteration structure.
|
|
// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate
|
|
// the layout of this structure.
|
|
type hiter struct {
|
|
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.
|
|
//
|
|
// The whySafe string is ignored, so that the function still inlines
|
|
// as efficiently as p+x, but all call sites should use the string to
|
|
// record why the addition is safe, which is to say why the addition
|
|
// does not cause x to advance to the very end of p's allocation
|
|
// and therefore point incorrectly at the next block in memory.
|
|
func add(p unsafe.Pointer, x uintptr, whySafe string) unsafe.Pointer {
|
|
return unsafe.Pointer(uintptr(p) + x)
|
|
}
|
|
|
|
// arrayAt returns the i-th element of p,
|
|
// an array whose elements are eltSize bytes wide.
|
|
// The array pointed at by p must have at least i+1 elements:
|
|
// it is invalid (but impossible to check here) to pass i >= len,
|
|
// because then the result will point outside the array.
|
|
// whySafe must explain why i < len. (Passing "i < len" is fine;
|
|
// the benefit is to surface this assumption at the call site.)
|
|
func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Pointer {
|
|
return add(p, uintptr(i)*eltSize, "i < len")
|
|
}
|