mirror of
https://github.com/golang/go
synced 2024-11-18 09:14:43 -07:00
refactor/rename: allow Force to make edits within autogenerated files.
Currently, as documented, gorename fails if it would cause an edit to an autogenerated file: - detect and reject edits to autogenerated files (cgo, protobufs) There are times when refactoring code where such an edit is necessary. This CL enables such edits if Force is set (which corresponds to gorename -force). Change-Id: If21249ae50d61fb5b59ee6e1ecf7157aaae0260a Reviewed-on: https://go-review.googlesource.com/118975 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
903a227b9b
commit
c6269430a5
@ -494,7 +494,7 @@ func (r *renamer) update() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(generatedFileNames) > 0 {
|
||||
if !Force && len(generatedFileNames) > 0 {
|
||||
return fmt.Errorf("refusing to modify generated file%s containing DO NOT EDIT marker: %v", plural(len(generatedFileNames)), generatedFileNames)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user