Skip to content

Commit

Permalink
aghos: imp docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Feb 9, 2024
1 parent 3afbbcb commit 185957c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ NOTE: Add new changes BELOW THIS COMMENT.

- Go 1.21 support. Future versions will require at least Go 1.22 to build.

### Fixed

- Incorrect tracking of the system hosts file's changes ([#6711]).

### Removed

- Go 1.20 support, as it has reached end of life.

[#6679]: https://github.com/AdguardTeam/AdGuardHome/issues/6679
[#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711

[go-toolchain]: https://go.dev/blog/toolchain

Expand Down
8 changes: 8 additions & 0 deletions internal/aghos/fswatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ type event = struct{}
// FSWatcher tracks all the fyle system events and notifies about those.
//
// TODO(e.burkov, a.garipov): Move into another package like aghfs.
//
// TODO(e.burkov): Add tests.
type FSWatcher interface {
// Start starts watching the added files.
Start() (err error)

// Close stops watching the files and closes an update channel.
io.Closer

// Events returns the channel to notify about the file system events.
Expand Down Expand Up @@ -103,6 +106,11 @@ func (w *osWatcher) Add(name string) (err error) {
name = filepath.Join("/", name)
w.files.Add(name)

// Watch the directory and filter the events by the file name, since the
// common recomendation to the fsnotify package is to watch the directory
// instead of the file itself.
//
// See https://pkg.go.dev/github.com/fsnotify/fsnotify@v1.7.0#readme-watching-a-file-doesn-t-work-well.
if !fi.IsDir() {
name = filepath.Dir(name)
}
Expand Down

0 comments on commit 185957c

Please sign in to comment.