From 6b3d49710be714c8355967d41b95295d4928cf54 Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Thu, 21 Apr 2016 17:30:17 -0700 Subject: [PATCH] Fix filewatch example Use last modified time when the time is parsed without error. This prevents an extra file read at start of watch for a connection. Fixes #125. --- examples/filewatch/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/filewatch/main.go b/examples/filewatch/main.go index a2c7b85..2ac2b32 100644 --- a/examples/filewatch/main.go +++ b/examples/filewatch/main.go @@ -120,7 +120,7 @@ func serveWs(w http.ResponseWriter, r *http.Request) { } var lastMod time.Time - if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err != nil { + if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err == nil { lastMod = time.Unix(0, n) }