File tree Expand file tree Collapse file tree 6 files changed +24
-132
lines changed
Expand file tree Collapse file tree 6 files changed +24
-132
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package exec
1818
1919import (
2020 "context"
21+ "errors"
2122 "io"
2223 "io/fs"
2324 osexec "os/exec"
@@ -97,6 +98,21 @@ func New() Interface {
9798 return & executor {}
9899}
99100
101+ // maskErrDotCmd reverts the behavior of osexec.Cmd to what it was before go1.19
102+ // specifically set the Err field to nil (LookPath returns a new error when the file
103+ // is resolved to the current directory.
104+ func maskErrDotCmd (cmd * osexec.Cmd ) * osexec.Cmd {
105+ cmd .Err = maskErrDot (cmd .Err )
106+ return cmd
107+ }
108+
109+ func maskErrDot (err error ) error {
110+ if err != nil && errors .Is (err , osexec .ErrDot ) {
111+ return nil
112+ }
113+ return err
114+ }
115+
100116// Command is part of the Interface interface.
101117func (executor * executor ) Command (cmd string , args ... string ) Cmd {
102118 return (* cmdWrapper )(maskErrDotCmd (osexec .Command (cmd , args ... )))
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ func New[E ordered](items ...E) Set[E] {
3434 return ss
3535}
3636
37+ // Clear empties the set.
38+ // It is preferable to replace the set with a newly constructed set,
39+ // but not all callers can do that (when there are other references to the map).
40+ func (s Set [T ]) Clear () Set [T ] {
41+ clear (s )
42+ return s
43+ }
44+
3745// KeySet creates a Set[E] from a keys of a map[E](? extends interface{}).
3846func KeySet [E ordered , A any ](theMap map [E ]A ) Set [E ] {
3947 ret := Set [E ]{}
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments