diff options
| author | Shulhan <ms@kilabit.info> | 2022-08-03 23:26:56 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-08-03 23:40:22 +0700 |
| commit | 1060faab647b444ffbd3cdc47c286c7ba56b72fb (patch) | |
| tree | d658705b4f8d70247436fd3c472bb63d0f11b969 | |
| parent | fcde3db519e5e560201f1acc7bb3139e0aa66c34 (diff) | |
| download | pakakeh.go-1060faab647b444ffbd3cdc47c286c7ba56b72fb.tar.xz | |
lib/memfs: suppress linter warnings for sending to channel using select
The idea on using select is to prevent the process being blocked when
sending to channel that is already full.
| -rw-r--r-- | lib/memfs/dirwatcher.go | 8 | ||||
| -rw-r--r-- | lib/memfs/watcher.go | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/memfs/dirwatcher.go b/lib/memfs/dirwatcher.go index 31edf3c9..e519fe7a 100644 --- a/lib/memfs/dirwatcher.go +++ b/lib/memfs/dirwatcher.go @@ -249,6 +249,8 @@ func (dw *DirWatcher) onContentChange(node *Node) { Node: *newChild, State: FileStateCreated, } + + //nolint select { case dw.qchanges <- ns: } @@ -301,6 +303,8 @@ func (dw *DirWatcher) onRootCreated() { Node: *dw.root, State: FileStateCreated, } + + //nolint select { case dw.qchanges <- ns: } @@ -324,6 +328,8 @@ func (dw *DirWatcher) onRootDeleted() { if debug.Value >= 2 { fmt.Println("DirWatcher.onRootDeleted: root directory deleted") } + + //nolint select { case dw.qchanges <- ns: } @@ -340,6 +346,8 @@ func (dw *DirWatcher) onModified(node *Node, newDirInfo os.FileInfo) { State: FileStateUpdateMode, } ) + + //nolint select { case dw.qchanges <- ns: } diff --git a/lib/memfs/watcher.go b/lib/memfs/watcher.go index 169c9852..050cc279 100644 --- a/lib/memfs/watcher.go +++ b/lib/memfs/watcher.go @@ -134,6 +134,8 @@ func (w *Watcher) start() { ns.Node = *w.node ns.State = FileStateDeleted + + //nolint select { case w.qchanges <- ns: } @@ -149,6 +151,8 @@ func (w *Watcher) start() { ns.Node = *w.node ns.State = FileStateUpdateMode + + //nolint select { case w.qchanges <- ns: } @@ -166,6 +170,8 @@ func (w *Watcher) start() { ns.Node = *w.node ns.State = FileStateUpdateContent + + //nolint select { case w.qchanges <- ns: } |
