use PrintErrln instead of log
This commit is contained in:
parent
9e6f648f0b
commit
2fd9b940d5
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue