mirror of
https://github.com/golang/go
synced 2024-11-18 10:54:40 -07:00
internal/lsp/fake: clean up Workspace.proxydir on close
This change was unfortunately lost while rebasing, resulting in a lot of unremoved directories. Change-Id: Icc1b667e31ac85e617b1c3a8d7c58f78e999d151 Reviewed-on: https://go-review.googlesource.com/c/tools/+/230314 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
4697a2867c
commit
7ae4988eb4
@ -308,7 +308,7 @@ func (w *Workspace) writeFileData(path string, content string) error {
|
||||
}
|
||||
|
||||
func (w *Workspace) removeAll() error {
|
||||
var wsErr, gopathErr error
|
||||
var wsErr, gopathErr, proxyErr error
|
||||
if w.gopath != "" {
|
||||
if err := w.RunGoCommand(context.Background(), "clean", "-modcache"); err != nil {
|
||||
gopathErr = fmt.Errorf("cleaning modcache: %v", err)
|
||||
@ -319,8 +319,11 @@ func (w *Workspace) removeAll() error {
|
||||
if w.workdir != "" {
|
||||
wsErr = os.RemoveAll(w.workdir)
|
||||
}
|
||||
if wsErr != nil || gopathErr != nil {
|
||||
return fmt.Errorf("error(s) cleaning workspace: removing workdir: %v; removing gopath: %v", wsErr, gopathErr)
|
||||
if w.proxydir != "" {
|
||||
proxyErr = os.RemoveAll(w.proxydir)
|
||||
}
|
||||
if wsErr != nil || gopathErr != nil || proxyErr != nil {
|
||||
return fmt.Errorf("error(s) cleaning workspace: removing workdir: %v; removing gopath: %v; removing proxy: %v", wsErr, gopathErr, proxyErr)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user