From dc82635562a7fb4488f374d7a9ed26b29310e918 Mon Sep 17 00:00:00 2001 From: mstmdev Date: Mon, 25 Sep 2023 16:35:27 +0800 Subject: [PATCH] database/sql: use the built-in min function --- src/database/sql/sql.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go index 7592bad1d3..013c03d97a 100644 --- a/src/database/sql/sql.go +++ b/src/database/sql/sql.go @@ -964,12 +964,7 @@ func (db *DB) shortestIdleTimeLocked() time.Duration { if db.maxLifetime <= 0 { return db.maxIdleTime } - - min := db.maxIdleTime - if min > db.maxLifetime { - min = db.maxLifetime - } - return min + return min(db.maxIdleTime, db.maxLifetime) } // SetMaxIdleConns sets the maximum number of connections in the idle