mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
remove RevertFiles function
This commit is contained in:
@@ -49,9 +49,8 @@ func Run(dir string) (ChecksResult, error) {
|
|||||||
|
|
||||||
err = RenameFiles(skipped)
|
err = RenameFiles(skipped)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Could not remove files:", err)
|
log.Println("Could not rename files:", err)
|
||||||
}
|
}
|
||||||
defer RevertFiles(skipped)
|
|
||||||
|
|
||||||
checks := []Check{
|
checks := []Check{
|
||||||
GoFmt{Dir: dir, Filenames: filenames},
|
GoFmt{Dir: dir, Filenames: filenames},
|
||||||
|
|||||||
@@ -82,19 +82,6 @@ func RenameFiles(names []string) (err error) {
|
|||||||
return err
|
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
|
// lineCount returns the number of lines in a given file
|
||||||
func lineCount(filepath string) (int, error) {
|
func lineCount(filepath string) (int, error) {
|
||||||
out, err := exec.Command("wc", "-l", filepath).Output()
|
out, err := exec.Command("wc", "-l", filepath).Output()
|
||||||
|
|||||||
Reference in New Issue
Block a user