summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-structr/util.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-06-21 15:43:17 +0000
committerLibravatar GitHub <noreply@github.com>2024-06-21 16:43:17 +0100
commitb93087ceb4f508c1d5262f363a21bdea3e502c31 (patch)
tree71ff80a06ee447f4694fd242cb84d9010fc46ccd /vendor/codeberg.org/gruf/go-structr/util.go
parent[feature] add worker task serialization logic (#2989) (diff)
downloadgotosocial-b93087ceb4f508c1d5262f363a21bdea3e502c31.tar.xz
[chore] update go-structr and go-mangler to no longer rely on modern-go/reflect2 (#3026)
* updates go-structr and go-mangler to no longer rely on modern-go/reflect2 (*phew* now we're go1.23 safe) * update go-structr version * bump go-structr to improve memory usage (v. slightly) in certain conditions
Diffstat (limited to 'vendor/codeberg.org/gruf/go-structr/util.go')
-rw-r--r--vendor/codeberg.org/gruf/go-structr/util.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/util.go b/vendor/codeberg.org/gruf/go-structr/util.go
index 46535fcff..84c98074d 100644
--- a/vendor/codeberg.org/gruf/go-structr/util.go
+++ b/vendor/codeberg.org/gruf/go-structr/util.go
@@ -1,5 +1,7 @@
package structr
+import "unsafe"
+
// once only executes 'fn' once.
func once(fn func()) func() {
var once int32
@@ -11,3 +13,9 @@ func once(fn func()) func() {
fn()
}
}
+
+// eface_data returns the data ptr from an empty interface.
+func eface_data(a any) unsafe.Pointer {
+ type eface struct{ _, data unsafe.Pointer }
+ return (*eface)(unsafe.Pointer(&a)).data
+}