Skip to content

Commit 2174de4

Browse files
Merge pull request #407 from sunnyraindy/master
refactor: replace interface{} with any for clarity and modernization
2 parents dac5e60 + 7cfad77 commit 2174de4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

log/log.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ var (
99
)
1010

1111
type PeerswapLogger interface {
12-
Infof(format string, v ...interface{})
13-
Debugf(format string, v ...interface{})
12+
Infof(format string, v ...any)
13+
Debugf(format string, v ...any)
1414
}
1515

1616
func SetLogger(peerswapLogger PeerswapLogger) {
1717
logger = peerswapLogger
1818
}
1919

20-
func Infof(format string, v ...interface{}) {
20+
func Infof(format string, v ...any) {
2121
if logger != nil {
2222
logger.Infof(format, v...)
2323
} else {
2424
log.Printf("[INFO] "+format, v...)
2525
}
2626
}
2727

28-
func Debugf(format string, v ...interface{}) {
28+
func Debugf(format string, v ...any) {
2929
if logger != nil {
3030
logger.Debugf(format, v...)
3131
} else {

timer/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66
)
77

8-
type CallbackFactory func(...interface{}) func()
8+
type CallbackFactory func(...any) func()
99

1010
type TimeOutService struct {
1111
CallbackFactory CallbackFactory
@@ -15,6 +15,6 @@ func NewTimeOutService(cbf CallbackFactory) *TimeOutService {
1515
return &TimeOutService{CallbackFactory: cbf}
1616
}
1717

18-
func (s *TimeOutService) AddNewTimeOut(ctx context.Context, d time.Duration, args ...interface{}) {
18+
func (s *TimeOutService) AddNewTimeOut(ctx context.Context, d time.Duration, args ...any) {
1919
go TimedCallback(ctx, d, s.CallbackFactory(args))
2020
}

0 commit comments

Comments
 (0)