Skip to content

Commit b803124

Browse files
committed
inline optimization for Logf
1 parent 193db9a commit b803124

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

try/out.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ type (
4343
//
4444
// error sending response: UDP not listening
4545
func (o *Result) Logf(a ...any) *Result {
46+
if o.Err == nil {
47+
return o
48+
}
4649
return o.logf(logfFrameLvl, a)
4750
}
4851

@@ -57,6 +60,9 @@ func (o *Result) Logf(a ...any) *Result {
5760
//
5861
// error sending response: UDP not listening
5962
func (o *Result1[T]) Logf(a ...any) *Result1[T] {
63+
if o.Err == nil {
64+
return o
65+
}
6066
o.Result.logf(logfFrameLvl, a)
6167
return o
6268
}
@@ -72,6 +78,9 @@ func (o *Result1[T]) Logf(a ...any) *Result1[T] {
7278
//
7379
// error sending response: UDP not listening
7480
func (o *Result2[T, U]) Logf(a ...any) *Result2[T, U] {
81+
if o.Err == nil {
82+
return o
83+
}
7584
o.Result.logf(logfFrameLvl, a)
7685
return o
7786
}
@@ -277,9 +286,6 @@ func wrapStr() string {
277286
}
278287

279288
func (o *Result) logf(lvl int, a []any) *Result {
280-
if o.Err == nil {
281-
return o
282-
}
283289
s := o.Err.Error()
284290
if len(a) != 0 {
285291
f, isFormat := a[0].(string)

0 commit comments

Comments
 (0)