i am working on a library for configuration named harvester(
https://github.com/taxibeat/harvester), which will be soon properly open 
sourced, where i can dynamically reconfigure the configuration from an 
outside system (consul).

The user provides a struct with some tags

type testConfig struct {
Name    string  `consul:"harvester1/name"`
}

the consul key is monitored and when it changes the filed Name is set via 
reflection `SetString(value)`.

the above runs in a go routine.

The struct/field is propagated via pointer to the rest of the code of the 
application so that a change in the struct is reflected.

Understandably the race detector fails because the goroutine changes the 
value and someone else is reading it.

There is always only one that writes and multiple that read.
Worst case you get the old value, best case you get the new value.
Is there a chance that reading and assigning values might not be atomic?


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/95ac522d-7cd4-4c34-b2cd-b00387cad849%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to