mirror of
https://github.com/golang/go
synced 2024-11-21 23:44:39 -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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -112,6 +113,7 @@ func clean(p *Package) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var b builder
|
var b builder
|
||||||
|
b.print = fmt.Print
|
||||||
|
|
||||||
packageFile := map[string]bool{}
|
packageFile := map[string]bool{}
|
||||||
if p.Name != "main" {
|
if p.Name != "main" {
|
||||||
@ -146,7 +148,7 @@ func clean(p *Package) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cleanN || cleanX {
|
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{}
|
toRemove := map[string]bool{}
|
||||||
@ -180,7 +182,7 @@ func clean(p *Package) {
|
|||||||
|
|
||||||
if cleanI && p.target != "" {
|
if cleanI && p.target != "" {
|
||||||
if cleanN || cleanX {
|
if cleanN || cleanX {
|
||||||
b.showcmd("", "rm %s", p.target)
|
b.showcmd("", "rm -f %s", p.target)
|
||||||
}
|
}
|
||||||
if !cleanN {
|
if !cleanN {
|
||||||
os.Remove(p.target)
|
os.Remove(p.target)
|
||||||
|
Loading…
Reference in New Issue
Block a user