mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
Add additional logging for rename failures (#58458)
To investigate an issue on dotcom.
This commit is contained in:
parent
5899d6f42b
commit
0f8d37bc1a
@ -11,6 +11,48 @@ go_library(
|
||||
],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/internal/fileutil",
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = select({
|
||||
"@io_bazel_rules_go//go/platform:aix": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:android": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:darwin": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:dragonfly": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:freebsd": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:illumos": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:ios": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:js": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:linux": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:netbsd": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:openbsd": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:plan9": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"@io_bazel_rules_go//go/platform:solaris": [
|
||||
"//lib/errors",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
||||
@ -6,6 +6,8 @@ package fileutil
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
// RenameAndSync will do an os.Rename followed by fsync to ensure the rename
|
||||
@ -13,7 +15,7 @@ import (
|
||||
func RenameAndSync(oldpath, newpath string) error {
|
||||
err := os.Rename(oldpath, newpath)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "failed to rename %q to %q", errors.Safe(oldpath), errors.Safe(newpath))
|
||||
}
|
||||
|
||||
oldparent, newparent := filepath.Dir(oldpath), filepath.Dir(newpath)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user