Skip to content

Commit

Permalink
fixed bug to open files
Browse files Browse the repository at this point in the history
  • Loading branch information
SidorkinAlex committed Aug 23, 2022
1 parent 44822a3 commit 8bd07a5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions internal/app/fileutils/file_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func RewriteFile(mes string, filename string) {
if err := f.Close(); err != nil {
log.Fatal(err)
}
f.Sync()
}

func HasFile(filePath string) bool {
Expand Down Expand Up @@ -72,12 +73,6 @@ func GetRootDir() string {
func ReadFile(filename string) string {
var fileContent string
if HasFile(filename) {
f, err := os.Open(filename)
if err != nil {
panic(err)
}
defer f.Close()

// для более мелких файлов
fContent, err := ioutil.ReadFile(filename)
if err != nil {
Expand Down

0 comments on commit 8bd07a5

Please sign in to comment.