Replace fmt.Errorf w/o %-style to errors.New

Using fmt.Errorf for errors that do not have %-style formatting
directives is an overkill. Switch to errors.New.

Found by

	git grep fmt.Errorf | grep -v ^vendor | grep -v '%'

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-06-08 11:24:00 -07:00
parent 242b3283fd
commit 627a06ad92
13 changed files with 57 additions and 42 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ package main
import (
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
@@ -115,11 +116,11 @@ func execProcess(context *cli.Context) (int, error) {
return -1, err
}
if status == libcontainer.Stopped {
return -1, fmt.Errorf("cannot exec a container that has stopped")
return -1, errors.New("cannot exec a container that has stopped")
}
path := context.String("process")
if path == "" && len(context.Args()) == 1 {
return -1, fmt.Errorf("process args cannot be empty")
return -1, errors.New("process args cannot be empty")
}
detach := context.Bool("detach")
state, err := container.State()