Commit 39611ec8 authored by Sanjay Menakuru's avatar Sanjay Menakuru Committed by Russ Cox

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
parent 74ee51ee
...@@ -5,6 +5,7 @@ ...@@ -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) { ...@@ -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) { ...@@ -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) { ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment