chore: use time.Now() instead of timex.Time() because go optimized it (#1860)

This commit is contained in:
Kevin Wan
2022-05-03 19:51:47 +08:00
committed by GitHub
parent ac321fc146
commit bab72b7630
7 changed files with 21 additions and 22 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/zeromicro/go-zero/core/fs"
"github.com/zeromicro/go-zero/core/lang"
"github.com/zeromicro/go-zero/core/timex"
)
const (
@@ -290,12 +289,12 @@ func (l *RotateLogger) write(v []byte) {
}
func compressLogFile(file string) {
start := timex.Now()
start := time.Now()
Infof("compressing log file: %s", file)
if err := gzipFile(file); err != nil {
Errorf("compress error: %s", err)
} else {
Infof("compressed log file: %s, took %s", file, timex.Since(start))
Infof("compressed log file: %s, took %s", file, time.Since(start))
}
}

View File

@@ -4,8 +4,7 @@ import (
"fmt"
"runtime"
"strings"
"github.com/zeromicro/go-zero/core/timex"
"time"
)
func getCaller(callDepth int) string {
@@ -18,7 +17,7 @@ func getCaller(callDepth int) string {
}
func getTimestamp() string {
return timex.Time().Format(timeFormat)
return time.Now().Format(timeFormat)
}
func prettyCaller(file string, line int) string {