@@ -19,6 +19,7 @@ package main
19
19
import (
20
20
"crypto/ecdsa"
21
21
"encoding/json"
22
+ "errors"
22
23
"fmt"
23
24
"os"
24
25
"path/filepath"
@@ -147,7 +148,7 @@ func dnsSync(ctx *cli.Context) error {
147
148
148
149
func dnsSign (ctx * cli.Context ) error {
149
150
if ctx .NArg () < 2 {
150
- return fmt . Errorf ("need tree definition directory and key file as arguments" )
151
+ return errors . New ("need tree definition directory and key file as arguments" )
151
152
}
152
153
var (
153
154
defdir = ctx .Args ().Get (0 )
@@ -201,7 +202,7 @@ func directoryName(dir string) string {
201
202
// dnsToTXT performs dnsTXTCommand.
202
203
func dnsToTXT (ctx * cli.Context ) error {
203
204
if ctx .NArg () < 1 {
204
- return fmt . Errorf ("need tree definition directory as argument" )
205
+ return errors . New ("need tree definition directory as argument" )
205
206
}
206
207
output := ctx .Args ().Get (1 )
207
208
if output == "" {
@@ -218,7 +219,7 @@ func dnsToTXT(ctx *cli.Context) error {
218
219
// dnsToCloudflare performs dnsCloudflareCommand.
219
220
func dnsToCloudflare (ctx * cli.Context ) error {
220
221
if ctx .NArg () != 1 {
221
- return fmt . Errorf ("need tree definition directory as argument" )
222
+ return errors . New ("need tree definition directory as argument" )
222
223
}
223
224
domain , t , err := loadTreeDefinitionForExport (ctx .Args ().Get (0 ))
224
225
if err != nil {
@@ -231,7 +232,7 @@ func dnsToCloudflare(ctx *cli.Context) error {
231
232
// dnsToRoute53 performs dnsRoute53Command.
232
233
func dnsToRoute53 (ctx * cli.Context ) error {
233
234
if ctx .NArg () != 1 {
234
- return fmt . Errorf ("need tree definition directory as argument" )
235
+ return errors . New ("need tree definition directory as argument" )
235
236
}
236
237
domain , t , err := loadTreeDefinitionForExport (ctx .Args ().Get (0 ))
237
238
if err != nil {
@@ -244,7 +245,7 @@ func dnsToRoute53(ctx *cli.Context) error {
244
245
// dnsNukeRoute53 performs dnsRoute53NukeCommand.
245
246
func dnsNukeRoute53 (ctx * cli.Context ) error {
246
247
if ctx .NArg () != 1 {
247
- return fmt . Errorf ("need domain name as argument" )
248
+ return errors . New ("need domain name as argument" )
248
249
}
249
250
client := newRoute53Client (ctx )
250
251
return client .deleteDomain (ctx .Args ().First ())
@@ -363,10 +364,10 @@ func loadTreeDefinitionForExport(dir string) (domain string, t *dnsdisc.Tree, er
363
364
// tree's signature if valid.
364
365
func ensureValidTreeSignature (t * dnsdisc.Tree , pubkey * ecdsa.PublicKey , sig string ) error {
365
366
if sig == "" {
366
- return fmt . Errorf ("missing signature, run 'devp2p dns sign' first" )
367
+ return errors . New ("missing signature, run 'devp2p dns sign' first" )
367
368
}
368
369
if err := t .SetSignature (pubkey , sig ); err != nil {
369
- return fmt . Errorf ("invalid signature on tree, run 'devp2p dns sign' to update it" )
370
+ return errors . New ("invalid signature on tree, run 'devp2p dns sign' to update it" )
370
371
}
371
372
return nil
372
373
}
0 commit comments