mirror of
https://github.com/slimtoolkit/slim.git
synced 2025-06-03 04:00:23 +00:00
chore: use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (#542)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
parent
871a9771a0
commit
09058e2d78
@ -2,7 +2,6 @@ package image
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@ -149,7 +148,7 @@ func getRegistryCredential(registryAccount, registrySecret, dockerConfigPath, re
|
||||
return
|
||||
}
|
||||
|
||||
missingAuthConfigErr := errors.New(fmt.Sprintf("could not find an auth config for registry - %s", registry))
|
||||
missingAuthConfigErr := fmt.Errorf("could not find an auth config for registry - %s", registry)
|
||||
if dockerConfigPath != "" {
|
||||
dAuthConfigs, err := docker.NewAuthConfigurationsFromFile(dockerConfigPath)
|
||||
if err != nil {
|
||||
|
@ -827,7 +827,7 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
|
||||
} else if strings.Index(paramParts[3], `\`) == 0 {
|
||||
// retries is printed as a C-escape
|
||||
if len(paramParts[3]) != 2 {
|
||||
err = errors.New(fmt.Sprintf("expected retries (%s) to be an escape sequence", paramParts[3]))
|
||||
err = fmt.Errorf("expected retries (%s) to be an escape sequence", paramParts[3])
|
||||
} else {
|
||||
escapeCodes := map[byte]int64{
|
||||
byte('a'): 7,
|
||||
@ -840,7 +840,7 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
|
||||
}
|
||||
var ok bool
|
||||
if retries, ok = escapeCodes[(paramParts[3])[1]]; !ok {
|
||||
err = errors.New(fmt.Sprintf("got an invalid escape sequence: %s", paramParts[3]))
|
||||
err = fmt.Errorf("got an invalid escape sequence: %s", paramParts[3])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user