@@ -8,12 +8,12 @@ import (
88 "context"
99 "crypto/sha256"
1010 "encoding/hex"
11+ "fmt"
1112 "io"
1213 "os"
1314 "path/filepath"
1415
1516 "github.com/fsnotify/fsnotify"
16- "golang.org/x/xerrors"
1717
1818 "github.com/gitpod-io/gitpod/common-go/log"
1919)
@@ -29,7 +29,7 @@ type fileWatcher struct {
2929func File (ctx context.Context , path string , onChange func ()) error {
3030 watcher , err := fsnotify .NewWatcher ()
3131 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 )
3333 }
3434
3535 fw := & fileWatcher {
@@ -40,7 +40,7 @@ func File(ctx context.Context, path string, onChange func()) error {
4040 // initial hash of the file
4141 hash , err := hashConfig (path )
4242 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 )
4444 }
4545
4646 // 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 {
5151 err = watcher .Add (watchDir )
5252 if err != nil {
5353 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 )
5555 }
5656
5757 log .Infof ("starting watch of file %v" , path )
@@ -60,11 +60,11 @@ func File(ctx context.Context, path string, onChange func()) error {
6060
6161 go func () {
6262 defer func () {
63- log .WithError (err ).Error ("stopping file watch" )
63+ log .WithError (err ).Error ("Stopping file watch" )
6464
6565 err = watcher .Close ()
6666 if err != nil {
67- log .WithError (err ).Error ("unexpected error closing file watcher" )
67+ log .WithError (err ).Error ("Unexpected error closing file watcher" )
6868 }
6969 }()
7070
@@ -81,7 +81,7 @@ func File(ctx context.Context, path string, onChange func()) error {
8181
8282 currentHash , err := hashConfig (path )
8383 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" )
8585 return
8686 }
8787
@@ -95,7 +95,7 @@ func File(ctx context.Context, path string, onChange func()) error {
9595 fw .hash = currentHash
9696 fw .onChange ()
9797 case err := <- watcher .Errors :
98- log .WithError (err ).Error ("unexpected error watching event" )
98+ log .WithError (err ).Error ("Unexpected error watching event" )
9999 case <- ctx .Done ():
100100 return
101101 }
0 commit comments