WithWd executes a function with the specified working directory.
(chDir string, f func(origWd string))
| 16 | |
| 17 | // WithWd executes a function with the specified working directory. |
| 18 | func WithWd(chDir string, f func(origWd string)) { |
| 19 | wd, err := os.Getwd() |
| 20 | if err != nil { |
| 21 | panic(err) |
| 22 | } |
| 23 | |
| 24 | if err := os.Chdir(chDir); err != nil { |
| 25 | panic(err) |
| 26 | } |
| 27 | defer os.Chdir(wd) |
| 28 | f(wd) |
| 29 | } |
no outgoing calls
searching dependent graphs…