Atlas › Test

TestMaskStruct_Nil

Exact test identity: go.temporal.io/server/common/masker/TestMaskStruct_Nil

Package
go.temporal.io/server/common/masker
Suite / test hierarchy
TestMaskStruct_Nil
Test
TestMaskStruct_Nil
Introduced at
masker.go ×1 Frontier kind: Joint frontier
Covered ranges
2
Covered lines
6
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/masker/masker.go 6 covered LOC · 2 ranges

Open complete file

39 // MaskStruct replace password values with mask and returns copy of the strct.
40 // Original strct value is not modified. Doesn't go recursively through strct properties.
41 > func MaskStruct(strct any, fieldNamesToMask []string) any { masker.go
42 > strctV := reflect.ValueOf(strct)
43 >
44 > if strct == nil || (strctV.Kind() == reflect.Pointer && strctV.IsNil()) {
45 > return strct masker.go
46 > }
47
48 for t := reflect.TypeOf(strct); t.Kind() == reflect.Pointer; t = t.Elem() {