Skip to content

Commit 3ae7c44

Browse files
authored
Merge pull request #816 from Tiper-In-Github/patch-1
Fix:err is never used
2 parents 9d809f6 + 0315631 commit 3ae7c44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: app/other/apis/sys_server_monitor.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ type ServerMonitor struct {
4949
// GetHourDiffer 获取相差时间
5050
func GetHourDiffer(startTime, endTime string) int64 {
5151
var hour int64
52-
t1, err := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local)
53-
t2, err := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local)
54-
if err == nil && t1.Before(t2) {
52+
t1, err1 := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local)
53+
t2, err2 := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local)
54+
if err1 == nil && err2 == nil && t1.Before(t2) {
5555
diff := t2.Unix() - t1.Unix() //
5656
hour = diff / 3600
5757
return hour
@@ -70,7 +70,7 @@ func GetHourDiffer(startTime, endTime string) int64 {
7070
func (e ServerMonitor) ServerInfo(c *gin.Context) {
7171
e.Context = c
7272

73-
sysInfo, err := host.Info()
73+
sysInfo, _ := host.Info()
7474
osDic := make(map[string]interface{}, 0)
7575
osDic["goOs"] = runtime.GOOS
7676
osDic["arch"] = runtime.GOARCH

0 commit comments

Comments
 (0)