I'm writing a small webserver program, and it does a lot of JSON decoding from POST requests coming in.
Initially I thought that instead of initializing a new json.Decoder
every time a request comes in, I have it as a global variable that gets called on every time and decodes concurrently with goroutines.
As a newcomer to Go, is this okay? Are there times when I shouldn't be doing this and classes will freak out due to not being thread safe (I guess "goroutine" safe would be better)?