From: Sergey Matveev Date: Fri, 17 Nov 2023 16:10:01 +0000 (+0300) Subject: Fix another whichdo regression fix X-Git-Tag: v2.4.0^0 X-Git-Url: http://www.git.cypherpunks.ru/?p=goredo.git;a=commitdiff_plain;h=a1e662d81cefe005525cc9537f246225a1b2ac49 Fix another whichdo regression fix --- diff --git a/doc/news.texi b/doc/news.texi index ae1ca4a..2684d05 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -2,6 +2,13 @@ @cindex news @unnumbered News +@anchor{Release 2_4_0} +@section Release 2.4.0 +@itemize +@item + Continue regression fixing of @command{redo-whichdo}. +@end itemize + @anchor{Release 2_3_0} @section Release 2.3.0 @itemize diff --git a/main.go b/main.go index d6ac0d3..504fa6c 100644 --- a/main.go +++ b/main.go @@ -21,9 +21,11 @@ import ( "bufio" "bytes" "encoding/hex" + "errors" "flag" "fmt" "io" + "io/fs" "log" "os" "os/signal" @@ -392,7 +394,12 @@ func main() { var dos []string dos, err = whichdo(tgts[0]) if err != nil { - break + if errors.Is(err, fs.ErrNotExist) { + err = nil + ok = false + } else { + break + } } for _, do := range dos { fmt.Println(do) diff --git a/usage.go b/usage.go index a091a92..cb2761f 100644 --- a/usage.go +++ b/usage.go @@ -24,7 +24,7 @@ import ( ) const ( - Version = "2.3.0" + Version = "2.4.0" Warranty = `Copyright (C) 2020-2023 Sergey Matveev This program is free software: you can redistribute it and/or modify diff --git a/whichdo.go b/whichdo.go index 4a22b10..5078775 100644 --- a/whichdo.go +++ b/whichdo.go @@ -1,8 +1,8 @@ package main import ( - "errors" "io" + "io/fs" "os" "path" ) @@ -51,7 +51,7 @@ func whichdo(tgt *Tgt) (dos []string, err error) { } } if doFile == "" { - err = errors.New("no .do found") + err = fs.ErrNotExist return } p := make([]string, 0, upLevels+2)