package main

import ""
import "fmt"

func main() {
    // Make the channel buffered to ensure no event is dropped. Notify will drop
    // an event if the receiver is not able to keep up the sending pace.
    c := make(chan notify.EventInfo, 1)

    // Set up a watchpoint listening on events within current working directory.
    // Dispatch each create and remove events separately to c.
    if err := notify.Watch(".", c, notify.Create, notify.Write, notify.Rename, notify.Remove); err != nil {
        fmt.Println("Error:", err)
    defer notify.Stop(c)

    // Block until an event is received.
    for ie := range c {

     fmt.Println("Got event:", ie)


标签: none