Skip to content

Commit

Permalink
add filename to error returned on config read
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-garcia committed Feb 28, 2024
1 parent e981ce9 commit c33089a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fsnotify/filewatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fsnotify

import (
"context"
"fmt"
"io/ioutil"
"log"
"net/url"
Expand All @@ -11,6 +12,7 @@ import (

rfsnotify "github.com/fsnotify/fsnotify"
"github.com/infobloxopen/hotload"
"github.com/pkg/errors"
)

func init() {
Expand Down Expand Up @@ -44,7 +46,7 @@ type pathWatch struct {
func readConfigFile(path string) (v []byte, err error) {
v, err = ioutil.ReadFile(path)
if err != nil {
return
return nil, errors.Wrap(err, fmt.Sprintf("could not read %v", path))
}
v = []byte(strings.TrimSpace(string(v)))
return
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/lib/pq v1.10.8
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.6
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
Expand Down

0 comments on commit c33089a

Please sign in to comment.