Skip to content

Commit

Permalink
Merge pull request #1 from SidorkinAlex/Fix_open_sockets
Browse files Browse the repository at this point in the history
fixed bug to open files
  • Loading branch information
SidorkinAlex authored Aug 23, 2022
2 parents 44822a3 + 8bd07a5 commit b928657
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 b928657

Please sign in to comment.