feat: Add function for backing up sources

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2021-05-12 15:46:01 +02:00
parent 4c3fcd20e4
commit f513a8d130
No known key found for this signature in database
GPG key ID: CD9628474574E0B6

14
main.go
View file

@ -3,6 +3,7 @@ package main
import (
"bufio"
"fmt"
"io"
"os"
"sort"
@ -68,7 +69,18 @@ func printComments(wrapper *wrap.Wrapper, commentsByFile map[string]([]*gitea.Pu
}
}
func patchFiles(wrapper *wrap.Wrapper, commentsByFile map[string]([]*gitea.PullReviewComment)) {
func BackUpSource(filepath string) {
inputFile, err := os.Open(filepath)
ExitOnError(err)
defer inputFile.Close()
BackUpSourceFile, err := os.Create(filepath + ".bck")
ExitOnError(err)
defer BackUpSourceFile.Close()
_, err = io.Copy(BackUpSourceFile, inputFile)
ExitOnError(err)
}
for filepath, comments := range commentsByFile {
fmt.Printf("FILE: %s\n", filepath)