cli/command/container: unnecessary use of fmt.Sprintf (gosimple)

cli/command/container/formatter_stats.go:184:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^
    cli/command/container/formatter_stats.go:191:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("-- / --")
                   ^
    cli/command/container/formatter_stats.go:201:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^
    cli/command/container/formatter_stats.go:184:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^
    cli/command/container/formatter_stats.go:191:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("-- / --")
                   ^
    cli/command/container/formatter_stats.go:201:10: S1039: unnecessary use of fmt.Sprintf (gosimple)
            return fmt.Sprintf("--")
                   ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5a65aadd8d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-27 19:48:55 +02:00
parent 715cfc4c2f
commit 80a3add604
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 6 additions and 6 deletions

View File

@ -181,14 +181,14 @@ func (c *statsContext) ID() string {
func (c *statsContext) CPUPerc() string { func (c *statsContext) CPUPerc() string {
if c.s.IsInvalid { if c.s.IsInvalid {
return fmt.Sprintf("--") return "--"
} }
return fmt.Sprintf("%.2f%%", c.s.CPUPercentage) return fmt.Sprintf("%.2f%%", c.s.CPUPercentage)
} }
func (c *statsContext) MemUsage() string { func (c *statsContext) MemUsage() string {
if c.s.IsInvalid { if c.s.IsInvalid {
return fmt.Sprintf("-- / --") return "-- / --"
} }
if c.os == winOSType { if c.os == winOSType {
return units.BytesSize(c.s.Memory) return units.BytesSize(c.s.Memory)
@ -198,28 +198,28 @@ func (c *statsContext) MemUsage() string {
func (c *statsContext) MemPerc() string { func (c *statsContext) MemPerc() string {
if c.s.IsInvalid || c.os == winOSType { if c.s.IsInvalid || c.os == winOSType {
return fmt.Sprintf("--") return "--"
} }
return fmt.Sprintf("%.2f%%", c.s.MemoryPercentage) return fmt.Sprintf("%.2f%%", c.s.MemoryPercentage)
} }
func (c *statsContext) NetIO() string { func (c *statsContext) NetIO() string {
if c.s.IsInvalid { if c.s.IsInvalid {
return fmt.Sprintf("--") return "--"
} }
return fmt.Sprintf("%s / %s", units.HumanSizeWithPrecision(c.s.NetworkRx, 3), units.HumanSizeWithPrecision(c.s.NetworkTx, 3)) return fmt.Sprintf("%s / %s", units.HumanSizeWithPrecision(c.s.NetworkRx, 3), units.HumanSizeWithPrecision(c.s.NetworkTx, 3))
} }
func (c *statsContext) BlockIO() string { func (c *statsContext) BlockIO() string {
if c.s.IsInvalid { if c.s.IsInvalid {
return fmt.Sprintf("--") return "--"
} }
return fmt.Sprintf("%s / %s", units.HumanSizeWithPrecision(c.s.BlockRead, 3), units.HumanSizeWithPrecision(c.s.BlockWrite, 3)) return fmt.Sprintf("%s / %s", units.HumanSizeWithPrecision(c.s.BlockRead, 3), units.HumanSizeWithPrecision(c.s.BlockWrite, 3))
} }
func (c *statsContext) PIDs() string { func (c *statsContext) PIDs() string {
if c.s.IsInvalid || c.os == winOSType { if c.s.IsInvalid || c.os == winOSType {
return fmt.Sprintf("--") return "--"
} }
return fmt.Sprintf("%d", c.s.PidsCurrent) return fmt.Sprintf("%d", c.s.PidsCurrent)
} }