forgejo/modules/log/groutinelabel.go
forgejo-backport-action 9830150297 [v7.0/forgejo] chore: Make Forgejo build with go1.24 (#7233)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/6299

- [Go 1.24](https://groups.google.com/g/golang-announce/c/vYMfuq_XO6w) is currently out for rc1.
- Using it to test unit tests and integration testing it failed horriblywith strange panics and errors, it is caused by ca63101df4 and Forgejo trying to access the wrong internal data structures that have been changed in Go 1.24.
- Use the new data structure for Go 1.24 and above.

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7233
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2025-03-15 16:03:19 +00:00

21 lines
429 B
Go

//go:build !go1.24
// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package log
import "unsafe"
//go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel
func runtime_getProfLabel() unsafe.Pointer //nolint
type labelMap map[string]string
func getGoroutineLabels() map[string]string {
l := (*labelMap)(runtime_getProfLabel())
if l == nil {
return nil
}
return *l
}