mirror of
https://github.com/golang/go
synced 2024-11-24 23:07:56 -07:00
cmd/go: fixed panic on go clean -n
and go clean -x
.
also made generated scripts act more like running go clean itself R=golang-dev CC=golang-dev, rsc https://golang.org/cl/5624049
This commit is contained in:
parent
74ee51ee92
commit
39611ec880
@ -5,6 +5,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -112,6 +113,7 @@ func clean(p *Package) {
|
||||
}
|
||||
|
||||
var b builder
|
||||
b.print = fmt.Print
|
||||
|
||||
packageFile := map[string]bool{}
|
||||
if p.Name != "main" {
|
||||
@ -146,7 +148,7 @@ func clean(p *Package) {
|
||||
}
|
||||
}
|
||||
if cleanN || cleanX {
|
||||
b.showcmd(p.Dir, "rm %s", strings.Join(allRemove, " "))
|
||||
b.showcmd(p.Dir, "rm -f %s", strings.Join(allRemove, " "))
|
||||
}
|
||||
|
||||
toRemove := map[string]bool{}
|
||||
@ -180,7 +182,7 @@ func clean(p *Package) {
|
||||
|
||||
if cleanI && p.target != "" {
|
||||
if cleanN || cleanX {
|
||||
b.showcmd("", "rm %s", p.target)
|
||||
b.showcmd("", "rm -f %s", p.target)
|
||||
}
|
||||
if !cleanN {
|
||||
os.Remove(p.target)
|
||||
|
Loading…
Reference in New Issue
Block a user