소스 검색

cmd/ursrv: Replace "2006-01-02" with time.DateOnly (#9157)

This commit replaces "2006-01-02" to time.DateOnly. time.DateOnly is
introduced since Go1.20
orangekame3 2 년 전
부모
커밋
5eb20580b1
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      cmd/ursrv/serve/serve.go

+ 3 - 3
cmd/ursrv/serve/serve.go

@@ -1014,7 +1014,7 @@ func getSummary(db *sql.DB, min int) (summary, error) {
 			ver = ver[:3] + "0" + ver[3:] // now v0.0x
 		}
 
-		s.setCount(day.Format("2006-01-02"), ver, num)
+		s.setCount(day.Format(time.DateOnly), ver, num)
 	}
 
 	s.filter(min)
@@ -1041,7 +1041,7 @@ func getPerformance(db *sql.DB) ([][]interface{}, error) {
 			return nil, err
 		}
 
-		row := []interface{}{day.Format("2006-01-02"), totFiles, totMiB, float64(int(sha256Perf*10)) / 10, memorySize, memoryUsage}
+		row := []interface{}{day.Format(time.DateOnly), totFiles, totMiB, float64(int(sha256Perf*10)) / 10, memorySize, memoryUsage}
 		res = append(res, row)
 	}
 
@@ -1071,7 +1071,7 @@ func getBlockStats(db *sql.DB) ([][]interface{}, error) {
 			continue
 		}
 		row := []interface{}{
-			day.Format("2006-01-02"),
+			day.Format(time.DateOnly),
 			reports,
 			pulled / blocksToGb,
 			renamed / blocksToGb,