mirror of
https://github.com/minio/mc.git
synced 2025-11-20 21:02:23 +03:00
lint: Fix new detected lint complaints (#5080)
This commit is contained in:
@@ -136,8 +136,8 @@ type Client interface {
|
||||
GetObjectLockConfig(ctx context.Context) (status string, mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, perr *probe.Error)
|
||||
|
||||
// Access policy operations.
|
||||
GetAccess(ctx context.Context) (access, policyJSON string, error *probe.Error)
|
||||
GetAccessRules(ctx context.Context) (policyRules map[string]string, error *probe.Error)
|
||||
GetAccess(ctx context.Context) (access, policyJSON string, err *probe.Error)
|
||||
GetAccessRules(ctx context.Context) (policyRules map[string]string, err *probe.Error)
|
||||
SetAccess(ctx context.Context, access string, isJSON bool) *probe.Error
|
||||
|
||||
// I/O operations
|
||||
|
||||
20
cmd/ping.go
20
cmd/ping.go
@@ -283,22 +283,22 @@ func pad(s, p string, count int, left bool) string {
|
||||
func pingStats(cliCtx *cli.Context, result madmin.AliveResult, serverMap map[string]serverStats) serverStats {
|
||||
var errorString string
|
||||
var sum, avg, dns uint64
|
||||
min := uint64(math.MaxUint64)
|
||||
var max uint64
|
||||
minPing := uint64(math.MaxUint64)
|
||||
var maxPing uint64
|
||||
var counter, errorCount int
|
||||
|
||||
if result.Error != nil {
|
||||
errorString = result.Error.Error()
|
||||
if stat, ok := serverMap[result.Endpoint.Host]; ok {
|
||||
min = stat.min
|
||||
max = stat.max
|
||||
minPing = stat.min
|
||||
maxPing = stat.max
|
||||
sum = stat.sum
|
||||
counter = stat.counter
|
||||
avg = stat.avg
|
||||
errorCount = stat.errorCount + 1
|
||||
|
||||
} else {
|
||||
min = 0
|
||||
minPing = 0
|
||||
errorCount = 1
|
||||
}
|
||||
if cliCtx.IsSet("error-count") && errorCount >= cliCtx.Int("error-count") {
|
||||
@@ -315,21 +315,21 @@ func pingStats(cliCtx *cli.Context, result madmin.AliveResult, serverMap map[str
|
||||
} else {
|
||||
minVal = stat.min
|
||||
}
|
||||
min = uint64(math.Min(float64(minVal), float64(uint64(result.ResponseTime))))
|
||||
max = uint64(math.Max(float64(stat.max), float64(uint64(result.ResponseTime))))
|
||||
minPing = uint64(math.Min(float64(minVal), float64(uint64(result.ResponseTime))))
|
||||
maxPing = uint64(math.Max(float64(stat.max), float64(uint64(result.ResponseTime))))
|
||||
sum = stat.sum + uint64(result.ResponseTime.Nanoseconds())
|
||||
counter = stat.counter + 1
|
||||
|
||||
} else {
|
||||
min = uint64(math.Min(float64(min), float64(uint64(result.ResponseTime))))
|
||||
max = uint64(math.Max(float64(max), float64(uint64(result.ResponseTime))))
|
||||
minPing = uint64(math.Min(float64(minPing), float64(uint64(result.ResponseTime))))
|
||||
maxPing = uint64(math.Max(float64(maxPing), float64(uint64(result.ResponseTime))))
|
||||
sum = uint64(result.ResponseTime)
|
||||
counter = 1
|
||||
}
|
||||
avg = sum / uint64(counter)
|
||||
dns = uint64(result.DNSResolveTime.Nanoseconds())
|
||||
}
|
||||
return serverStats{min, max, sum, avg, dns, errorCount, errorString, counter}
|
||||
return serverStats{minPing, maxPing, sum, avg, dns, errorCount, errorString, counter}
|
||||
}
|
||||
|
||||
// mainPing is entry point for ping command.
|
||||
|
||||
@@ -147,11 +147,11 @@ func (m *speedTestUI) View() string {
|
||||
dres := m.result.DriveResult
|
||||
cres := m.result.ClientResult
|
||||
|
||||
trailerIfGreaterThan := func(in string, max int) string {
|
||||
if len(in) < max {
|
||||
trailerIfGreaterThan := func(in string, maxIdx int) string {
|
||||
if len(in) < maxIdx {
|
||||
return in
|
||||
}
|
||||
return in[:max] + "..."
|
||||
return in[:maxIdx] + "..."
|
||||
}
|
||||
|
||||
// Print the spinner
|
||||
|
||||
@@ -73,13 +73,6 @@ func UTCNow() time.Time {
|
||||
return time.Now().UTC()
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// randString generates random names and prepends them with a known prefix.
|
||||
func randString(n int, src rand.Source, prefix string) string {
|
||||
if n == 0 {
|
||||
|
||||
Reference in New Issue
Block a user