use PrintErrln instead of log
This commit is contained in:
parent
9e6f648f0b
commit
2fd9b940d5
|
|
@ -18,7 +18,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -47,7 +46,8 @@ func divisorSum(cmd *cobra.Command, args []string) {
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
n, ok := new(big.Int).SetString(arg, 10)
|
n, ok := new(big.Int).SetString(arg, 10)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Print("invalid input " + arg)
|
cmd.PrintErrln("invalid input " + arg)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
d := divisorSummatory(n)
|
d := divisorSummatory(n)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -32,7 +31,7 @@ func isprime(cmd *cobra.Command, args []string) {
|
||||||
for _, s := range args {
|
for _, s := range args {
|
||||||
_, ok := x.SetString(s, 10)
|
_, ok := x.SetString(s, 10)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Print("invalid input " + s)
|
cmd.PrintErrln("invalid input " + s)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -31,13 +30,13 @@ func sqrtRepetend(cmd *cobra.Command, args []string) {
|
||||||
for _, s := range args {
|
for _, s := range args {
|
||||||
_, ok := x.SetString(s, 10)
|
_, ok := x.SetString(s, 10)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Print("invalid input " + s)
|
cmd.PrintErrln("invalid input " + s)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
repetend, err := lib.SqrtRepetend(x)
|
repetend, err := lib.SqrtRepetend(x)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(s + " is a perfect square")
|
cmd.PrintErrln(s + " is a perfect square")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue