Skip to content

Instantly share code, notes, and snippets.

@illicitonion
Created October 2, 2015 03:04
Show Gist options
  • Save illicitonion/b0d0af8a720667c80f00 to your computer and use it in GitHub Desktop.
Save illicitonion/b0d0af8a720667c80f00 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"os"
"path/filepath"
fsnotify "gopkg.in/fsnotify.v1"
)
func main() {
if err := os.Mkdir("dir", 0700); err != nil {
log.Fatalf("Error making directory: %v", err)
}
if err := os.Symlink(".", "dir/symlink"); err != nil {
log.Fatalf("Error making symlink: %v", err)
}
w, err := fsnotify.NewWatcher()
if err != nil {
log.Fatalf("Error making watcher: %v", err)
}
dir, err := os.Getwd()
if err != nil {
log.Fatalf("Error getting wd: %v", err)
}
w.Add(filepath.Join(dir, "dir"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment