Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(283)

Delta Between Two Patch Sets: src/cmd/go/clean.go

Issue 6635064: code review 6635064: cmd/go: don't ignore error when 'go clean' (Closed)
Left Patch Set: diff -r 8209534dab87 https://code.google.com/p/go/ Created 12 years, 5 months ago
Right Patch Set: diff -r 236ee151d1bc https://code.google.com/p/go/ Created 12 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
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 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b