From da4f1b43ce4053e60e56b3a118d9037afc1d92df Mon Sep 17 00:00:00 2001 From: Alexander Andryashin Date: Sun, 27 Nov 2016 15:52:35 +0300 Subject: [PATCH] Added sample code to readme --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d5d4410..1e97fb9 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,25 @@ Library for automatic reloading configuration files based on file system events. ## Using -`import github.com/aandryashin/reloader` +```go +package main + +import ( + "log" + "time" + + "github.com/aandryashin/reloader" +) + +func loadConfig() { + //... +} + +func main() { + err := reloader.Watch("config", loadConfig, 5*time.Second) + if err != nil { + log.Fatal(err) + } + //... +} +```