From eff9c0c8c6d32c2060841a9b9b98d9d4b38540b2 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 17 Nov 2021 10:30:17 +0100 Subject: Refactored to replace github pkg errors dependencies with fmt.Errorf --- pkg/config/command.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'pkg/config/command.go') diff --git a/pkg/config/command.go b/pkg/config/command.go index 34142cd..ad19142 100644 --- a/pkg/config/command.go +++ b/pkg/config/command.go @@ -1,9 +1,8 @@ package config import ( + "fmt" "strings" - - "github.com/pkg/errors" ) func validateCommand(cmd string) error { @@ -11,22 +10,22 @@ func validateCommand(cmd string) error { switch tokens[0] { case "cp": if len(tokens) != 3 { - return errors.New("cp command takes exactly two arguments") + return fmt.Errorf("cp command takes exactly two arguments") } case "exec": if len(tokens) <= 1 { - return errors.New("exec command needs arguments") + return fmt.Errorf("exec command needs arguments") } case "mkdir": if len(tokens) != 2 { - return errors.New("mkdir command takes exactly one argument") + return fmt.Errorf("mkdir command takes exactly one argument") } case "wait": if len(tokens) != 1 { - return errors.New("wait command takes no arguments") + return fmt.Errorf("wait command takes no arguments") } default: - return errors.New("Invalid command : " + tokens[0]) + return fmt.Errorf("Invalid command : " + tokens[0]) } return nil } -- cgit v1.2.3