The global var should have been protected by a mutex, or loaded and saved
using sync/atomic functions, as it is accessed from multiple goroutines.
Another minor point:
Why do:
result := fmt.Sprintf("Hello there %s", i)
io.WriteString(w, result)
instead of just:
fmt.Fprintf(w, "Hello there %s",
try using a global var.
something like https://play.golang.org/p/05-xBDh5rgn
On Thursday, 4 January 2018 15:09:41 UTC, Keith Brown wrote:
>
> I am trying to Serve a webpage while running a ticker in the background. I
> am trying to generate a random number, genRandom() , periodically and
>