Skip to content

Commit

Permalink
Fix build on Plan 9
Browse files Browse the repository at this point in the history
This fixes build for programs that import fsnotify but fsnotify is not
absolutely necessary for the program to be useful.
  • Loading branch information
fhs authored and arp242 committed Jul 21, 2022
1 parent 808f582 commit 9426c52
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fen.go
Expand Up @@ -32,7 +32,7 @@ func (w *Watcher) Add(name string) error {
return nil
}

// Remove stops watching the the named file or directory (non-recursively).
// Remove stops watching the named file or directory (non-recursively).
func (w *Watcher) Remove(name string) error {
return nil
}
2 changes: 1 addition & 1 deletion kqueue.go
Expand Up @@ -102,7 +102,7 @@ func (w *Watcher) Add(name string) error {
return err
}

// Remove stops watching the the named file or directory (non-recursively).
// Remove stops watching the named file or directory (non-recursively).
func (w *Watcher) Remove(name string) error {
name = filepath.Clean(name)
w.mu.Lock()
Expand Down
35 changes: 35 additions & 0 deletions plan9.go
@@ -0,0 +1,35 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build plan9

package fsnotify

import "syscall"

// Watcher watches a set of files, delivering events to a channel.
type Watcher struct {
Events chan Event
Errors chan error
}

// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
func NewWatcher() (*Watcher, error) {
return nil, syscall.EPLAN9
}

// Close removes all watches and closes the events channel.
func (w *Watcher) Close() error {
return syscall.EPLAN9
}

// Add starts watching the named file or directory (non-recursively).
func (w *Watcher) Add(name string) error {
return syscall.EPLAN9
}

// Remove stops watching the named file or directory (non-recursively).
func (w *Watcher) Remove(name string) error {
return syscall.EPLAN9
}
2 changes: 1 addition & 1 deletion windows.go
Expand Up @@ -92,7 +92,7 @@ func (w *Watcher) Add(name string) error {
return <-in.reply
}

// Remove stops watching the the named file or directory (non-recursively).
// Remove stops watching the named file or directory (non-recursively).
func (w *Watcher) Remove(name string) error {
in := &input{
op: opRemoveWatch,
Expand Down

0 comments on commit 9426c52

Please sign in to comment.