LEFT | RIGHT |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "io/ioutil" | 9 "io/ioutil" |
10 "os" | 10 "os" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 name := dir.Name() | 163 name := dir.Name() |
164 if dir.IsDir() { | 164 if dir.IsDir() { |
165 // TODO: Remove once Makefiles are forgotten. | 165 // TODO: Remove once Makefiles are forgotten. |
166 if cleanDir[name] { | 166 if cleanDir[name] { |
167 if cleanN || cleanX { | 167 if cleanN || cleanX { |
168 b.showcmd(p.Dir, "rm -r %s", name) | 168 b.showcmd(p.Dir, "rm -r %s", name) |
169 if cleanN { | 169 if cleanN { |
170 continue | 170 continue |
171 } | 171 } |
172 } | 172 } |
173 » » » » f := filepath.Join(p.Dir, name) | 173 » » » » if err := os.RemoveAll(filepath.Join(p.Dir, name
)); err != nil { |
174 » » » » if err := os.RemoveAll(f); err != nil { | |
175 errorf("go clean: %v", err) | 174 errorf("go clean: %v", err) |
176 } | 175 } |
177 } | 176 } |
178 continue | 177 continue |
179 } | 178 } |
180 | 179 |
181 if cleanN { | 180 if cleanN { |
182 continue | 181 continue |
183 } | 182 } |
184 | 183 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 216 } |
218 } | 217 } |
219 | 218 |
220 // removeFile tries to remove file f, if error other than file doesn't exist | 219 // removeFile tries to remove file f, if error other than file doesn't exist |
221 // occurs, it will report the error. | 220 // occurs, it will report the error. |
222 func removeFile(f string) { | 221 func removeFile(f string) { |
223 if err := os.Remove(f); err != nil && !os.IsNotExist(err) { | 222 if err := os.Remove(f); err != nil && !os.IsNotExist(err) { |
224 errorf("go clean: %v", err) | 223 errorf("go clean: %v", err) |
225 } | 224 } |
226 } | 225 } |
LEFT | RIGHT |