diff --git a/cmd/divisor.go b/cmd/divisor.go index 4a00a1f..c64dd0b 100644 --- a/cmd/divisor.go +++ b/cmd/divisor.go @@ -18,7 +18,6 @@ package cmd import ( "fmt" - "log" "math/big" "github.com/spf13/cobra" @@ -47,7 +46,8 @@ func divisorSum(cmd *cobra.Command, args []string) { for _, arg := range args { n, ok := new(big.Int).SetString(arg, 10) if !ok { - log.Print("invalid input " + arg) + cmd.PrintErrln("invalid input " + arg) + continue } d := divisorSummatory(n) diff --git a/cmd/isprime.go b/cmd/isprime.go index 283b86c..bfd832d 100644 --- a/cmd/isprime.go +++ b/cmd/isprime.go @@ -18,7 +18,6 @@ package cmd import ( "fmt" - "log" "math/big" "github.com/spf13/cobra" @@ -32,7 +31,7 @@ func isprime(cmd *cobra.Command, args []string) { for _, s := range args { _, ok := x.SetString(s, 10) if !ok { - log.Print("invalid input " + s) + cmd.PrintErrln("invalid input " + s) continue } diff --git a/cmd/sqrtRepetend.go b/cmd/sqrtRepetend.go index 62c73b3..3d72bdb 100644 --- a/cmd/sqrtRepetend.go +++ b/cmd/sqrtRepetend.go @@ -18,7 +18,6 @@ package cmd import ( "fmt" - "log" "math/big" "github.com/spf13/cobra" @@ -31,13 +30,13 @@ func sqrtRepetend(cmd *cobra.Command, args []string) { for _, s := range args { _, ok := x.SetString(s, 10) if !ok { - log.Print("invalid input " + s) + cmd.PrintErrln("invalid input " + s) continue } repetend, err := lib.SqrtRepetend(x) if err != nil { - log.Print(s + " is a perfect square") + cmd.PrintErrln(s + " is a perfect square") continue }