use PrintErrln instead of log

This commit is contained in:
filifa 2025-09-18 00:09:28 -04:00
parent 9e6f648f0b
commit 2fd9b940d5
3 changed files with 5 additions and 7 deletions

View File

@ -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)

View File

@ -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
}

View File

@ -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
}