diff --git a/README.md b/README.md index a0ccc90..34b1371 100644 --- a/README.md +++ b/README.md @@ -544,7 +544,7 @@ Google's protobuf library is used to design protocol data. The protocol data str message Header { RequestType requestType = 1; bytes requestId = 2; - string error = 3; + string error = 3; } enum RequestType { diff --git a/pkg/types/fileinfo/fileinfo.go b/pkg/types/fileinfo/fileinfo.go index 411a4b0..4d4c9cb 100644 --- a/pkg/types/fileinfo/fileinfo.go +++ b/pkg/types/fileinfo/fileinfo.go @@ -84,6 +84,7 @@ func (f *FileInfo) WriteFileWithInfo(filePath string, fileContent io.Reader) err if err != nil { return err } + defer file.Close() // Set file metadata. err = file.Chmod(f.Mode) @@ -119,6 +120,7 @@ func (f *FileInfo) WriteFileWithInfo(filePath string, fileContent io.Reader) err return err } } + defer file.Close() // Write file content. n, err := io.Copy(file, fileContent)