1
0
mirror of https://github.com/golang/go synced 2024-10-02 12:08:32 -06: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:
Sanjay Menakuru 2012-02-06 12:40:59 -05:00 committed by Russ Cox
parent 74ee51ee92
commit 39611ec880

View File

@ -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)