Oops, meant to type GoRename instead of GoVet
On Friday, May 3, 2019 at 4:05:59 PM UTC-4, michae...@gmail.com wrote:
>
> Thanks, Tamás. That worked. Still a bit tedious since GoVet was taking
> about 6 seconds to rename all the instances of each struct field. But it's
> done now.
>
> On
Thanks, Tamás. That worked. Still a bit tedious since GoVet was taking
about 6 seconds to rename all the instances of each struct field. But it's
done now.
On Friday, May 3, 2019 at 3:58:34 PM UTC-4, Tamás Gulácsi wrote:
>
> Rename the struct fields first, then move it to its own package.
I want to make part of my main package into an internal package. It's only
one file and I only need to export a single struct type and one function.
Seemed easy enough -- just git mv the file to ../internal/ and use
GoRename in vim. Problem is that all the struct fields are lowercase and
FWIW, here's the pattern I've settled on for my actual application.
https://play.golang.org/p/OBVsp-Rjknf
It uses sync.Mutex only and includes the mutex as a member of the
guardedState struct. The deciding factor was that my industrial control
application has a very large state struct with
I found a good discussion in the FAQ that explains the problem clearly.
https://golang.org/doc/faq#methods_on_values_or_pointers
I think the mutex is needed on the update function with or without the use
of sync/atomic. The atomic guards the Load and the Store but the func is
operating on the
Good to know about not needing sync/atomic. I used a pointer to an
externally defined mutex because an answer I found on StackOverflow
recommended doing that. However, on looking at my application more closely
I think you're right about putting it inside the struct.
On Sunday, April 14, 2019
https://play.golang.org/p/6aQYNjojyBD
I'm clearly missing something about the way sync.Mutex and atomic.Value
work in Go.
I'm attempting to write a pair of concurrency safe methods, load() and
update(), for accessing a struct. The struct is stored as an atomic.Value
and accessed with
Hi, new gopher here.
I considered asking this on SO, but they (rightly, IMO) discourage "Is this
a good way to do it?" questions. Hope that's ok here.
By way of background, I'm porting a largish industrial control application
from Python to Go. The Python version uses multiple processes