internal/trace: support event constructor for testing

Implement the new APIs described in #74826.

Closes #74826

Change-Id: I6a6a6964229548e9d54e7af95185011e183ee50b
Reviewed-on: https://go-review.googlesource.com/c/go/+/691815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Felix Geisendörfer 2025-07-02 11:26:17 +02:00
parent eb63ef9d66
commit 54b82e944e
6 changed files with 1243 additions and 37 deletions

View file

@ -58,10 +58,12 @@ func (v Value) String() string {
return "Value{Bad}"
}
func uint64Value(x uint64) Value {
// Uint64Value creates a value of kind ValueUint64.
func Uint64Value(x uint64) Value {
return Value{kind: ValueUint64, scalar: x}
}
func stringValue(s string) Value {
// StringValue creates a value of kind ValueString.
func StringValue(s string) Value {
return Value{kind: ValueString, scalar: uint64(len(s)), pointer: unsafe.Pointer(unsafe.StringData(s))}
}