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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -149,7 +148,7 @@ func getRegistryCredential(registryAccount, registrySecret, dockerConfigPath, re
|
|||||||
return
|
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 != "" {
|
if dockerConfigPath != "" {
|
||||||
dAuthConfigs, err := docker.NewAuthConfigurationsFromFile(dockerConfigPath)
|
dAuthConfigs, err := docker.NewAuthConfigurationsFromFile(dockerConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -827,7 +827,7 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
|
|||||||
} else if strings.Index(paramParts[3], `\`) == 0 {
|
} else if strings.Index(paramParts[3], `\`) == 0 {
|
||||||
// retries is printed as a C-escape
|
// retries is printed as a C-escape
|
||||||
if len(paramParts[3]) != 2 {
|
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 {
|
} else {
|
||||||
escapeCodes := map[byte]int64{
|
escapeCodes := map[byte]int64{
|
||||||
byte('a'): 7,
|
byte('a'): 7,
|
||||||
@ -840,7 +840,7 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
|
|||||||
}
|
}
|
||||||
var ok bool
|
var ok bool
|
||||||
if retries, ok = escapeCodes[(paramParts[3])[1]]; !ok {
|
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 {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user