@@ -8,12 +8,12 @@ import (
8
8
"context"
9
9
"crypto/sha256"
10
10
"encoding/hex"
11
+ "fmt"
11
12
"io"
12
13
"os"
13
14
"path/filepath"
14
15
15
16
"github.com/fsnotify/fsnotify"
16
- "golang.org/x/xerrors"
17
17
18
18
"github.com/gitpod-io/gitpod/common-go/log"
19
19
)
@@ -29,7 +29,7 @@ type fileWatcher struct {
29
29
func File (ctx context.Context , path string , onChange func ()) error {
30
30
watcher , err := fsnotify .NewWatcher ()
31
31
if err != nil {
32
- return xerrors .Errorf ("unexpected error creating file watcher: %w" , err )
32
+ return fmt .Errorf ("unexpected error creating file watcher: %w" , err )
33
33
}
34
34
35
35
fw := & fileWatcher {
@@ -40,7 +40,7 @@ func File(ctx context.Context, path string, onChange func()) error {
40
40
// initial hash of the file
41
41
hash , err := hashConfig (path )
42
42
if err != nil {
43
- return xerrors .Errorf ("cannot get hash of file %v: %w" , path , err )
43
+ return fmt .Errorf ("cannot get hash of file %v: %w" , path , err )
44
44
}
45
45
46
46
// visible files in a volume are symlinks to files in the writer's data directory.
@@ -51,7 +51,7 @@ func File(ctx context.Context, path string, onChange func()) error {
51
51
err = watcher .Add (watchDir )
52
52
if err != nil {
53
53
watcher .Close ()
54
- return xerrors .Errorf ("unexpected error watching file %v: %w" , path , err )
54
+ return fmt .Errorf ("unexpected error watching file %v: %w" , path , err )
55
55
}
56
56
57
57
log .Infof ("starting watch of file %v" , path )
@@ -60,11 +60,11 @@ func File(ctx context.Context, path string, onChange func()) error {
60
60
61
61
go func () {
62
62
defer func () {
63
- log .WithError (err ).Error ("stopping file watch" )
63
+ log .WithError (err ).Error ("Stopping file watch" )
64
64
65
65
err = watcher .Close ()
66
66
if err != nil {
67
- log .WithError (err ).Error ("unexpected error closing file watcher" )
67
+ log .WithError (err ).Error ("Unexpected error closing file watcher" )
68
68
}
69
69
}()
70
70
@@ -81,7 +81,7 @@ func File(ctx context.Context, path string, onChange func()) error {
81
81
82
82
currentHash , err := hashConfig (path )
83
83
if err != nil {
84
- log .WithError (err ).Warn ("cannot check if config has changed" )
84
+ log .WithError (err ).Warn ("Cannot check if config has changed" )
85
85
return
86
86
}
87
87
@@ -95,7 +95,7 @@ func File(ctx context.Context, path string, onChange func()) error {
95
95
fw .hash = currentHash
96
96
fw .onChange ()
97
97
case err := <- watcher .Errors :
98
- log .WithError (err ).Error ("unexpected error watching event" )
98
+ log .WithError (err ).Error ("Unexpected error watching event" )
99
99
case <- ctx .Done ():
100
100
return
101
101
}
0 commit comments