replace some basic uses of fmt.Sprintf()
Really tiny gains here, and doesn't significantly impact readability:
BenchmarkSprintf
BenchmarkSprintf-10 11528700 91.59 ns/op 32 B/op 1 allocs/op
BenchmarkConcat
BenchmarkConcat-10 100000000 11.76 ns/op 0 B/op 0 allocs/op
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
4
task.go
4
task.go
@@ -311,7 +311,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
|
||||
switch status.Status {
|
||||
case Stopped, Unknown, "":
|
||||
case Created:
|
||||
if t.client.runtime == fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "windows") {
|
||||
if t.client.runtime == plugin.RuntimePlugin.String()+".windows" {
|
||||
// On windows Created is akin to Stopped
|
||||
break
|
||||
}
|
||||
@@ -328,7 +328,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
|
||||
// io.Wait locks for restored tasks on Windows unless we call
|
||||
// io.Close first (https://github.com/containerd/containerd/issues/5621)
|
||||
// in other cases, preserve the contract and let IO finish before closing
|
||||
if t.client.runtime == fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "windows") {
|
||||
if t.client.runtime == plugin.RuntimePlugin.String()+".windows" {
|
||||
t.io.Close()
|
||||
}
|
||||
// io.Cancel is used to cancel the io goroutine while it is in
|
||||
|
||||
Reference in New Issue
Block a user