mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 14:29:05 +08:00
remove RevertFiles function
This commit is contained in:
@@ -49,9 +49,8 @@ func Run(dir string) (ChecksResult, error) {
|
||||
|
||||
err = RenameFiles(skipped)
|
||||
if err != nil {
|
||||
log.Println("Could not remove files:", err)
|
||||
log.Println("Could not rename files:", err)
|
||||
}
|
||||
defer RevertFiles(skipped)
|
||||
|
||||
checks := []Check{
|
||||
GoFmt{Dir: dir, Filenames: filenames},
|
||||
|
||||
@@ -82,19 +82,6 @@ func RenameFiles(names []string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// RevertFiles removes the ".grc.bk" extension from files
|
||||
func RevertFiles(names []string) (err error) {
|
||||
for i := range names {
|
||||
tmpErr := os.Rename(names[i]+".grc.bk", names[i])
|
||||
if tmpErr != nil {
|
||||
// save this error, but still continue with other files
|
||||
err = tmpErr
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// lineCount returns the number of lines in a given file
|
||||
func lineCount(filepath string) (int, error) {
|
||||
out, err := exec.Command("wc", "-l", filepath).Output()
|
||||
|
||||
Reference in New Issue
Block a user