return values.
As a practical example, consider the fsnotify package's "NewWatcher" -->
http://godoc.org/gopkg.in/fsnotify.v1#NewWatcher
It returns a *Watcher along with a error
If I've declared my local struct as follows:
type localWatcher struct {
*fsnotify.Watcher
}
How can I go about initializing localWatcher? The following does not work
as multiple values are returned by the NewWatcher constructor.
watcher:=localWatcher{fsnotify.NewWatcher()}
My current solution seems a bit verbose, so I'm wondering if there is a
more idiomatic Go way to accomplish the following:
_watcher,err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
watcher := localWatcher{_watcher}
Thanks in advance.
-Chrys
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.