| 1 |
// Copyright 2025 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// Package label provides common declarations used by both the [runtime] and [runtime/pprof] packages. |
| 6 |
// The [Set] type is used for goroutine labels, and is duplicated as |
| 7 |
// [runtime/pprof.LabelSet]. The type is duplicated due to go.dev/issue/65437 |
| 8 |
// preventing the use of a type-alias in an existing public interface. |
| 9 |
package label |
| 10 |
|
| 11 |
// Label is a key/value pair of strings. |
| 12 |
type Label struct { |
| 13 |
Key string |
| 14 |
Value string |
| 15 |
} |
| 16 |
|
| 17 |
// Set is a set of labels. |
| 18 |
type Set struct { |
| 19 |
List []Label |
| 20 |
} |
| 21 |
|
| 22 |
// NewSet constructs a LabelSet that wraps the provided labels. |
| 23 |
func NewSet(list []Label) Set { |
| 24 |
return Set{List: list} |
| 25 |
} |