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 committed Nov 10, 2020
1 parent 7f4cf4d commit eedcc9d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fen.go
Expand Up @@ -31,7 +31,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: 0 additions & 2 deletions fsnotify.go
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build !plan9

// Package fsnotify provides a platform-independent interface for file system notifications.
package fsnotify

Expand Down
2 changes: 1 addition & 1 deletion kqueue.go
Expand Up @@ -99,7 +99,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 @@ -81,7 +81,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 eedcc9d

Please sign in to comment.