mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Fix lint issues from v1.62.0 upgrade (#20633)
* Fix lint issues from v1.62.0 upgrade * Fix xlMetaV2TrimData version checks.
This commit is contained in:
@@ -79,10 +79,10 @@ func (eDate *ExpirationDate) UnmarshalXML(d *xml.Decoder, startElement xml.Start
|
||||
return errLifecycleInvalidDate
|
||||
}
|
||||
// Allow only date timestamp specifying midnight GMT
|
||||
hr, min, sec := expDate.Clock()
|
||||
hr, m, sec := expDate.Clock()
|
||||
nsec := expDate.Nanosecond()
|
||||
loc := expDate.Location()
|
||||
if !(hr == 0 && min == 0 && sec == 0 && nsec == 0 && loc.String() == time.UTC.String()) {
|
||||
if !(hr == 0 && m == 0 && sec == 0 && nsec == 0 && loc.String() == time.UTC.String()) {
|
||||
return errLifecycleDateNotMidnight
|
||||
}
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ func (tDate *TransitionDate) UnmarshalXML(d *xml.Decoder, startElement xml.Start
|
||||
return errTransitionInvalidDate
|
||||
}
|
||||
// Allow only date timestamp specifying midnight GMT
|
||||
hr, min, sec := trnDate.Clock()
|
||||
hr, m, sec := trnDate.Clock()
|
||||
nsec := trnDate.Nanosecond()
|
||||
loc := trnDate.Location()
|
||||
if !(hr == 0 && min == 0 && sec == 0 && nsec == 0 && loc.String() == time.UTC.String()) {
|
||||
if !(hr == 0 && m == 0 && sec == 0 && nsec == 0 && loc.String() == time.UTC.String()) {
|
||||
return errTransitionDateNotMidnight
|
||||
}
|
||||
|
||||
|
||||
@@ -63,14 +63,14 @@ func (c *OperatorDNS) addAuthHeader(r *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *OperatorDNS) endpoint(bucket string, delete bool) (string, error) {
|
||||
func (c *OperatorDNS) endpoint(bucket string, del bool) (string, error) {
|
||||
u, err := url.Parse(c.Endpoint)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
q := u.Query()
|
||||
q.Add("bucket", bucket)
|
||||
q.Add("delete", strconv.FormatBool(delete))
|
||||
q.Add("delete", strconv.FormatBool(del))
|
||||
u.RawQuery = q.Encode()
|
||||
return u.String(), nil
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ type Config struct {
|
||||
}
|
||||
|
||||
// Update - updates the config with latest values
|
||||
func (c *Config) Update(new Config) error {
|
||||
func (c *Config) Update(updated Config) error {
|
||||
configLk.Lock()
|
||||
defer configLk.Unlock()
|
||||
c.MaxTimeout = getMaxTimeout(new.MaxTimeout)
|
||||
c.MaxTimeout = getMaxTimeout(updated.MaxTimeout)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -22,16 +22,16 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func backoffWait(min, unit, cap time.Duration) func(*rand.Rand, uint) time.Duration {
|
||||
func backoffWait(minSleep, unit, maxSleep time.Duration) func(*rand.Rand, uint) time.Duration {
|
||||
if unit > time.Hour {
|
||||
// Protect against integer overflow
|
||||
panic("unit cannot exceed one hour")
|
||||
}
|
||||
return func(r *rand.Rand, attempt uint) time.Duration {
|
||||
sleep := min
|
||||
sleep := minSleep
|
||||
sleep += unit * time.Duration(attempt)
|
||||
if sleep > cap {
|
||||
sleep = cap
|
||||
if sleep > maxSleep {
|
||||
sleep = maxSleep
|
||||
}
|
||||
sleep -= time.Duration(r.Float64() * float64(sleep))
|
||||
return sleep
|
||||
|
||||
@@ -32,8 +32,11 @@ import (
|
||||
var tlsClientSessionCacheSize = 100
|
||||
|
||||
const (
|
||||
WriteBufferSize = 64 << 10 // WriteBufferSize 64KiB moving up from 4KiB default
|
||||
ReadBufferSize = 64 << 10 // ReadBufferSize 64KiB moving up from 4KiB default
|
||||
// WriteBufferSize 64KiB moving up from 4KiB default
|
||||
WriteBufferSize = 64 << 10
|
||||
|
||||
// ReadBufferSize 64KiB moving up from 4KiB default
|
||||
ReadBufferSize = 64 << 10
|
||||
)
|
||||
|
||||
// ConnSettings - contains connection settings.
|
||||
|
||||
@@ -448,7 +448,7 @@ func (c *Client) LastError() error {
|
||||
|
||||
// computes the exponential backoff duration according to
|
||||
// https://www.awsarchitectureblog.com/2015/03/backoff.html
|
||||
func exponentialBackoffWait(r *rand.Rand, unit, cap time.Duration) func(uint) time.Duration {
|
||||
func exponentialBackoffWait(r *rand.Rand, unit, maxSleep time.Duration) func(uint) time.Duration {
|
||||
if unit > time.Hour {
|
||||
// Protect against integer overflow
|
||||
panic("unit cannot exceed one hour")
|
||||
@@ -460,8 +460,8 @@ func exponentialBackoffWait(r *rand.Rand, unit, cap time.Duration) func(uint) ti
|
||||
}
|
||||
// sleep = random_between(unit, min(cap, base * 2 ** attempt))
|
||||
sleep := unit * time.Duration(1<<attempt)
|
||||
if sleep > cap {
|
||||
sleep = cap
|
||||
if sleep > maxSleep {
|
||||
sleep = maxSleep
|
||||
}
|
||||
sleep -= time.Duration(r.Float64() * float64(sleep-unit))
|
||||
return sleep
|
||||
|
||||
Reference in New Issue
Block a user