Skip to content

Commit 1b5cfc6

Browse files
mstmdevgopherbot
authored andcommitted
database/sql: use the built-in min function
Change-Id: Ib6a0e1e1583e45e3d239455e8b131c81602b2d5d GitHub-Last-Rev: dc82635 GitHub-Pull-Request: #63200 Reviewed-on: https://go-review.googlesource.com/c/go/+/530875 Reviewed-by: qiulaidongfeng <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 90276c2 commit 1b5cfc6

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/database/sql/sql.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -964,12 +964,7 @@ func (db *DB) shortestIdleTimeLocked() time.Duration {
964964
if db.maxLifetime <= 0 {
965965
return db.maxIdleTime
966966
}
967-
968-
min := db.maxIdleTime
969-
if min > db.maxLifetime {
970-
min = db.maxLifetime
971-
}
972-
return min
967+
return min(db.maxIdleTime, db.maxLifetime)
973968
}
974969

975970
// SetMaxIdleConns sets the maximum number of connections in the idle

0 commit comments

Comments
 (0)