@@ -33,7 +33,7 @@ func (SlogSink) LogEntry(ctx context.Context, e slog.SinkEntry) {
33
33
attribute .String ("slog.message" ,e .Message ),
34
34
attribute .String ("slog.func" ,e .Func ),
35
35
attribute .String ("slog.file" ,e .File ),
36
- attribute .Int64 ("slog.line" ,int64 (e .Line )),
36
+ attribute .Int64 ("slog.line" ,int64 (e .Line )),// #nosec G115 -- int to int64 is safe
37
37
}
38
38
attributes = append (attributes ,slogFieldsToAttributes (e .Fields )... )
39
39
@@ -61,36 +61,38 @@ func slogFieldsToAttributes(m slog.Map) []attribute.KeyValue {
61
61
case []float64 :
62
62
value = attribute .Float64SliceValue (v )
63
63
case int :
64
- value = attribute .Int64Value (int64 (v ))
64
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
65
65
case []int :
66
66
value = attribute .IntSliceValue (v )
67
67
case int8 :
68
- value = attribute .Int64Value (int64 (v ))
68
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
69
69
// no int8 slice method
70
70
case int16 :
71
- value = attribute .Int64Value (int64 (v ))
71
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
72
72
// no int16 slice method
73
73
case int32 :
74
- value = attribute .Int64Value (int64 (v ))
74
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
75
75
// no int32 slice method
76
76
case int64 :
77
77
value = attribute .Int64Value (v )
78
78
case []int64 :
79
79
value = attribute .Int64SliceValue (v )
80
80
case uint :
81
- value = attribute .Int64Value (int64 (v ))
81
+ // If v is larger than math.MaxInt64, this will overflow, but this is acceptable for our tracing use case
82
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- acceptable overflow for tracing context
82
83
// no uint slice method
83
84
case uint8 :
84
- value = attribute .Int64Value (int64 (v ))
85
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
85
86
// no uint8 slice method
86
- case uint16 :
87
- value = attribute .Int64Value (int64 (v ))
87
+ case uint16 :// #nosec G115 -- int to int64 is safe
88
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
88
89
// no uint16 slice method
89
90
case uint32 :
90
- value = attribute .Int64Value (int64 (v ))
91
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- int to int64 is safe
91
92
// no uint32 slice method
92
93
case uint64 :
93
- value = attribute .Int64Value (int64 (v ))
94
+ // If v is larger than math.MaxInt64, this will overflow, but this is acceptable for our tracing use case
95
+ value = attribute .Int64Value (int64 (v ))// #nosec G115 -- acceptable overflow for tracing context
94
96
// no uint64 slice method
95
97
case string :
96
98
value = attribute .StringValue (v )