diff options
| author | 2025-04-07 11:03:57 +0100 | |
|---|---|---|
| committer | 2025-04-07 11:03:57 +0100 | |
| commit | 2cc5d6269d2ad3326c4ba4c6378fb0e9404646d0 (patch) | |
| tree | 411267365a530a8911bc3e80c19de97b6bec843a /vendor/codeberg.org/gruf/go-structr/runtime.go | |
| parent | [bugfix] Change email `Date` header to use RFC2822 (#3972) (diff) | |
| download | gotosocial-2cc5d6269d2ad3326c4ba4c6378fb0e9404646d0.tar.xz | |
[chore]: Bump codeberg.org/gruf/go-structr from 0.9.0 to 0.9.6 (#3973)
Bumps codeberg.org/gruf/go-structr from 0.9.0 to 0.9.6.
---
updated-dependencies:
- dependency-name: codeberg.org/gruf/go-structr
dependency-version: 0.9.6
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/codeberg.org/gruf/go-structr/runtime.go')
| -rw-r--r-- | vendor/codeberg.org/gruf/go-structr/runtime.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/runtime.go b/vendor/codeberg.org/gruf/go-structr/runtime.go index cd7f8d7a1..b75dfeba0 100644 --- a/vendor/codeberg.org/gruf/go-structr/runtime.go +++ b/vendor/codeberg.org/gruf/go-structr/runtime.go @@ -1,10 +1,9 @@ -//go:build go1.22 || go1.23 +//go:build go1.22 && !go1.25 package structr import ( "fmt" - "os" "reflect" "runtime" "strings" @@ -140,7 +139,7 @@ func extract_fields(ptr unsafe.Pointer, fields []struct_field) []unsafe.Pointer // Prepare slice of field value pointers. ptrs := make([]unsafe.Pointer, len(fields)) if len(ptrs) != len(fields) { - panic("BCE") + panic(assert("BCE")) } for i, field := range fields { @@ -264,12 +263,12 @@ func panicf(format string, args ...any) { panic(fmt.Sprintf(format, args...)) } -// should_not_reach can be called to indicated a -// block of code should not be able to be reached, -// else it prints callsite info with a BUG report. +// assert can be called to indicated a block +// of code should not be able to be reached, +// it returns a BUG report with callsite. // //go:noinline -func should_not_reach(exit bool) { +func assert(assert string) string { pcs := make([]uintptr, 1) _ = runtime.Callers(2, pcs) fn := runtime.FuncForPC(pcs[0]) @@ -280,9 +279,11 @@ func should_not_reach(exit bool) { funcname = funcname[i+1:] } } - if exit { - panic("BUG: assertion failed in " + funcname) - } else { - os.Stderr.WriteString("BUG: assertion failed in " + funcname + "\n") - } + var buf strings.Builder + buf.Grow(32 + len(assert) + len(funcname)) + buf.WriteString("BUG: assertion \"") + buf.WriteString(assert) + buf.WriteString("\" failed in ") + buf.WriteString(funcname) + return buf.String() } |
