feat: Add function for backing up sources
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
4c3fcd20e4
commit
f513a8d130
1 changed files with 13 additions and 1 deletions
14
main.go
14
main.go
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue