illarion / gonotify

Inotify wrapper
MIT License
30 stars 5 forks source link

Function NewFileWatcherSlice added #1

Closed joehil closed 5 years ago

joehil commented 5 years ago

I really like your project gonotify!! Unfortunately I needed a new function NewFileWatcherSlice that I incorporated in my fork.

Would you like reviewing it and adding it to your project?

Thank you very much!

With kindest regards Joehil

illarion commented 5 years ago

Hi @joehil , sorry for late answer. Could you please describe your use-case?

illarion commented 5 years ago

From what I see, you want to use slice instead of list of arguments. Please consider following example how you can do that without PR:

package main

import (
    "fmt"
)

func FileWatcher(mask int, files ...string) {

    fmt.Println("mask:", mask)

    for _, x := range files {
        fmt.Println(x)
    }
}

func main() {
    FileWatcher(1, "A", "B", "C")

    slice := []string{}
    slice = append(slice, "X")
    slice = append(slice, "Y")
    slice = append(slice, "Z")

    FileWatcher(2, slice...)

}

https://play.golang.org/p/fNT5n3zDofU