mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-21 12:44:49 -05:00
Merge pull request 'chore: Make Forgejo build with go1.24' (#6299) from gusted/forgejo-go1.24 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6299 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
43b09077c5
2 changed files with 40 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
//go:build !go1.24
|
||||
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
|
|
38
modules/log/groutinelabel_go1.24.go
Normal file
38
modules/log/groutinelabel_go1.24.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
//go:build go1.24
|
||||
|
||||
// Copyright 2024 The Forgejo 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
|
||||
|
||||
// Struct definitions copied from: https://github.com/golang/go/blob/ca63101df47a4467bc80faa654fc19d68e583952/src/runtime/pprof/label.go
|
||||
type label struct {
|
||||
key string
|
||||
value string
|
||||
}
|
||||
|
||||
type LabelSet struct {
|
||||
list []label
|
||||
}
|
||||
|
||||
type labelMap struct {
|
||||
LabelSet
|
||||
}
|
||||
|
||||
func getGoroutineLabels() map[string]string {
|
||||
l := (*labelMap)(runtime_getProfLabel())
|
||||
if l == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
m := make(map[string]string, len(l.list))
|
||||
for _, label := range l.list {
|
||||
m[label.key] = label.value
|
||||
}
|
||||
return m
|
||||
}
|
Loading…
Reference in a new issue