Skip to content

Commit 8d05fa1

Browse files
committed
chore: apply feedback
1 parent ec371e0 commit 8d05fa1

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

client.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"errors"
77
"fmt"
88
"io"
9-
"log"
109
"os"
1110
"time"
1211

@@ -77,12 +76,16 @@ func printIter(w io.Writer, prettyOutput bool, iter iter.ResultIter[types.Record
7776
fmt.Fprintln(w, "\tAddresses:", record.Addrs)
7877

7978
default:
80-
// You may not want to fail here, it's up to you. You can just handle
81-
// the schemas you want, or that you know, but not fail.
82-
log.Printf("unrecognized schema: %s", res.Val.GetSchema())
79+
// This is an unknown schema. Let's just print it raw.
80+
err := json.NewEncoder(w).Encode(res.Val)
81+
if err != nil {
82+
return err
83+
}
8384
}
85+
86+
fmt.Fprintln(w)
8487
} else {
85-
err := json.NewEncoder(os.Stdout).Encode(res.Val)
88+
err := json.NewEncoder(w).Encode(res.Val)
8689
if err != nil {
8790
return err
8891
}
@@ -125,12 +128,12 @@ func getIPNS(ctx context.Context, name ipns.Name, endpoint string, prettyOutput
125128
// do not need to verify it again. However, if you were not using this specific
126129
// client, but using some other tool, you should always validate the IPNS Record
127130
// using the [ipns.Validate] or [ipns.ValidateWithName] functions.
128-
fmt.Println("\tSignature: VALID")
131+
fmt.Println("\tSignature Validated")
129132
fmt.Println("\tValue:", v.String())
130133
fmt.Println("\tSequence:", seq)
134+
fmt.Println("\tValidityType : EOL/End-of-Life")
131135
fmt.Println("\tValidity:", eol.Format(time.RFC3339))
132-
ttl, err := rec.TTL()
133-
if err == nil {
136+
if ttl, err := rec.TTL(); err == nil {
134137
fmt.Println("\tTTL:", ttl.String())
135138
}
136139

0 commit comments

Comments
 (0)