@@ -185,7 +185,7 @@ func (fs *FileStore) DeletePreCommitDir(allocID string) error {
185185 return nil
186186}
187187
188- func (fs * FileStore ) CommitWrite (allocID , conID string , fileData * FileInputData ) (bool , error ) {
188+ func (fs * FileStore ) CommitWrite (allocID , conID string , fileData * FileInputData ) (_ bool , err error ) {
189189
190190 logging .Logger .Info ("Committing write" , zap .String ("allocation_id" , allocID ), zap .Any ("file_data" , fileData ))
191191 filePathHash := encryption .Hash (fileData .Path )
@@ -198,7 +198,7 @@ func (fs *FileStore) CommitWrite(allocID, conID string, fileData *FileInputData)
198198
199199 preCommitPath := fs .getPreCommitPathForFile (allocID , fileHash , VERSION )
200200
201- err : = createDirs (filepath .Dir (preCommitPath ))
201+ err = createDirs (filepath .Dir (preCommitPath ))
202202 if err != nil {
203203 return false , common .NewError ("blob_object_precommit_dir_creation_error" , err .Error ())
204204 }
@@ -288,12 +288,14 @@ func (fs *FileStore) CommitWrite(allocID, conID string, fileData *FileInputData)
288288 validationRoot := hex .EncodeToString (validationRootBytes )
289289 elapsedRoot := time .Since (now ) - elapsedWait
290290 if fmtRoot != fileData .FixedMerkleRoot {
291- return false , common .NewError ("fixed_merkle_root_mismatch" ,
291+ err = common .NewError ("fixed_merkle_root_mismatch" ,
292292 fmt .Sprintf ("Expected %s got %s" , fileData .FixedMerkleRoot , fmtRoot ))
293+ return false , err
293294 }
294295 if validationRoot != fileData .ValidationRoot {
295- return false , common .NewError ("validation_root_mismatch" ,
296+ err = common .NewError ("validation_root_mismatch" ,
296297 "calculated validation root does not match with client's validation root" )
298+ return false , err
297299 }
298300
299301 err = os .Rename (tempFilePath , preCommitPath )
0 commit comments