error strings should not be capitalized

Signed-off-by: Zechun Chen <zechun.chen@daocloud.io>
This commit is contained in:
Zechun Chen 2023-02-15 14:30:36 +08:00
parent 4b80a2be96
commit 39bac0dbef
4 changed files with 11 additions and 11 deletions

View File

@ -65,12 +65,12 @@ var runCommand = cli.Command{
spec, err := os.ReadFile(context.Args().First()) spec, err := os.ReadFile(context.Args().First())
if err != nil { if err != nil {
return fmt.Errorf("Failed to read sandbox config: %w", err) return fmt.Errorf("failed to read sandbox config: %w", err)
} }
ociSpec := oci.Spec{} ociSpec := oci.Spec{}
if err = json.Unmarshal(spec, &ociSpec); err != nil { if err = json.Unmarshal(spec, &ociSpec); err != nil {
return fmt.Errorf("Failed to parse sandbox config: %w", err) return fmt.Errorf("failed to parse sandbox config: %w", err)
} }
client, ctx, cancel, err := commands.NewClient(context) client, ctx, cancel, err := commands.NewClient(context)

View File

@ -57,16 +57,16 @@ func getContextWithCancel() (context.Context, context.CancelFunc) {
// verifySandboxStatus verified whether all required fields are set in PodSandboxStatus. // verifySandboxStatus verified whether all required fields are set in PodSandboxStatus.
func verifySandboxStatus(status *runtimeapi.PodSandboxStatus) error { func verifySandboxStatus(status *runtimeapi.PodSandboxStatus) error {
if status.Id == "" { if status.Id == "" {
return fmt.Errorf("Id is not set") return fmt.Errorf("id is not set")
} }
if status.Metadata == nil { if status.Metadata == nil {
return fmt.Errorf("Metadata is not set") return fmt.Errorf("metadata is not set")
} }
metadata := status.Metadata metadata := status.Metadata
if metadata.Name == "" || metadata.Namespace == "" || metadata.Uid == "" { if metadata.Name == "" || metadata.Namespace == "" || metadata.Uid == "" {
return fmt.Errorf("Name, Namespace or Uid is not in metadata %q", metadata) return fmt.Errorf("name, namespace or uid is not in metadata %q", metadata)
} }
if status.CreatedAt == 0 { if status.CreatedAt == 0 {
@ -79,16 +79,16 @@ func verifySandboxStatus(status *runtimeapi.PodSandboxStatus) error {
// verifyContainerStatus verified whether all required fields are set in ContainerStatus. // verifyContainerStatus verified whether all required fields are set in ContainerStatus.
func verifyContainerStatus(status *runtimeapi.ContainerStatus) error { func verifyContainerStatus(status *runtimeapi.ContainerStatus) error {
if status.Id == "" { if status.Id == "" {
return fmt.Errorf("Id is not set") return fmt.Errorf("id is not set")
} }
if status.Metadata == nil { if status.Metadata == nil {
return fmt.Errorf("Metadata is not set") return fmt.Errorf("metadata is not set")
} }
metadata := status.Metadata metadata := status.Metadata
if metadata.Name == "" { if metadata.Name == "" {
return fmt.Errorf("Name is not in metadata %q", metadata) return fmt.Errorf("name is not in metadata %q", metadata)
} }
if status.CreatedAt == 0 { if status.CreatedAt == 0 {
@ -96,7 +96,7 @@ func verifyContainerStatus(status *runtimeapi.ContainerStatus) error {
} }
if status.Image == nil || status.Image.Image == "" { if status.Image == nil || status.Image.Image == "" {
return fmt.Errorf("Image is not set") return fmt.Errorf("image is not set")
} }
if status.ImageRef == "" { if status.ImageRef == "" {

View File

@ -32,7 +32,7 @@ import (
var ( var (
// ErrEmptyPrefix is an error returned if the prefix was empty. // ErrEmptyPrefix is an error returned if the prefix was empty.
ErrEmptyPrefix = errors.New("Prefix can't be empty") ErrEmptyPrefix = errors.New("prefix can't be empty")
// ErrIllegalChar is returned when a space is in the ID // ErrIllegalChar is returned when a space is in the ID
ErrIllegalChar = errors.New("illegal character: ' '") ErrIllegalChar = errors.New("illegal character: ' '")

View File

@ -49,7 +49,7 @@ func init() {
localClient, ok := i.(*Local) localClient, ok := i.(*Local)
if !ok { if !ok {
return nil, errors.New("Could not create a local client for introspection service") return nil, errors.New("could not create a local client for introspection service")
} }
localClient.UpdateLocal(ic.Root) localClient.UpdateLocal(ic.Root)