You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: internal/fs/atomic.go
+32-17Lines changed: 32 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,26 @@ import (
4
4
"io"
5
5
"io/fs"
6
6
"os"
7
-
"path"
7
+
"path/filepath"
8
+
"sync"
8
9
9
10
"github.com/pkg/errors"
10
11
)
11
12
12
13
typeAtomicWriterstruct {
13
-
filenamestring
14
-
tempFile*os.File
14
+
dir, namestring
15
+
tempFile*os.File
16
+
17
+
lock sync.Mutex
15
18
}
16
19
17
20
var_ io.WriteCloser=&AtomicWriter{}
18
21
19
22
// NewAtomicWriter returns an io.WriteCloser that will write contents to a temp file and move that temp file to the destination filename. If the destination
20
23
// filename already exists, this constructor will copy the file to <filename>-old, truncating that file if it already exists.
0 commit comments