Suppress the error when we're removing a file that may not exist
// Remove head in case there is a conflict.
file := path.Join(pr.BaseRepo.RepoPath(), headFile)
- if err := os.Remove(file); err != nil {
- return fmt.Errorf("Fail to remove dir %s: %v", path.Join(pr.BaseRepo.RepoPath(), headFile), err)
- }
+ _ = os.Remove(file)
+
if err = git.Push(headRepoPath, tmpRemoteName, fmt.Sprintf("%s:%s", pr.HeadBranch, headFile)); err != nil {
return fmt.Errorf("Push: %v", err)
}
// So we want to make sure the symlink is removed before write anything.
// The new file we created will be in normal text format.
- if err := os.Remove(filename); err != nil {
- return fmt.Errorf("Fail to remove %s: %v", filename, err)
- }
+ _ = os.Remove(filename)
if err = ioutil.WriteFile(filename, []byte(content), 0666); err != nil {
return fmt.Errorf("WriteFile: %v", err)