Skip to content

Commit

Permalink
refactor: Update OpenFile to support reading and writing files
Browse files Browse the repository at this point in the history
This commit updates the OpenFile function in pkg/utils/io.go to support both reading and writing files. Previously, it only allowed writing to files. The change modifies the file opening flags from os.O_CREATE|os.O_WRONLY|os.O_APPEND to os.O_CREATE|os.O_RDWR|os.O_APPEND, enabling both read and write access to the file.

Refactor the OpenFile function to support reading and writing files
  • Loading branch information
WangYihang committed Jun 28, 2024
1 parent 9db494c commit a8583a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/utils/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ func OpenFile(path string) (io.WriteCloser, error) {
return nil, err
}
// Open file
return os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
return os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)
}
}

0 comments on commit a8583a7

Please sign in to comment.