Re: [go-nuts] Do I need to hold a lock of a struct to read the member concurrently?

2021-01-10 Thread 김용빈
Haha, thanks. I didn't feel get pushed. :) 2021년 1월 10일 일요일 오후 9시 36분 39초 UTC+9에 axel.wa...@googlemail.com님이 작성: > On Sun, Jan 10, 2021 at 12:57 PM 김용빈 wrote: > >> Thank you Wagner, as always! >> >> Yes, I asked because it is a field of a struct. With your answer, n

Re: [go-nuts] Do I need to hold a lock of a struct to read the member concurrently?

2021-01-10 Thread 김용빈
> fields that may be addressed individually. Each such element acts like a >> variable. > > > Okay, so every field can be treated as its own variable. Thus, applying > the rules of the memory model to individual fields is correct. > > On Sun, Jan 10, 2021 at 10:30 AM 김용

[go-nuts] Do I need to hold a lock of a struct to read the member concurrently?

2021-01-10 Thread 김용빈
I have a struct that will be used concurrently. type A struct { sync.Mutex id string // other members ... } The other members of A will be concurrently read or written. So I think I have to hold lock of A for those. But A.id will be written once at creation time of A (when it

Re: [go-nuts] when do you use sync.Mutex instead of sync.RWMutex

2020-12-20 Thread 김용빈
an `RWMutex`, all >> things being equal. >> >> So I tend to handle it the exact opposite of what you suggest - unless I >> have a specific reason to use `RWMutex`, I default to `Mutex`. >> >> On Sun, Dec 20, 2020 at 9:44 AM 김용빈 wrote: >> >>> we usually

[go-nuts] when do you use sync.Mutex instead of sync.RWMutex

2020-12-20 Thread 김용빈
we usually both read and write for a value. not only read, nor write. with that, I feel RWMutex is always right choice. when should I use Mutex instead of RWMutex? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] finding a way to convert "map[string]map[string]Somthing" into "map[string]interface{}"

2019-03-02 Thread 김용빈
cated and doesn't have to touch the > template. Something like this: > > var MapStringInterface map[string]interface{} > for i,x := range MapStringMapStringThing { > MapStringInterface[i]=x > } > > On Saturday, 2 March 2019 11:01:10 UTC+1, 김용빈 wrote: >> >> Thank you

[go-nuts] finding a way to convert "map[string]map[string]Somthing" into "map[string]interface{}"

2019-03-02 Thread 김용빈
I wanted sorted key of a map, of course I can do this. // myMap => map[string]map[string]Something keys := make([]string, 0) for k := range myMap { keys = append(keys, k) } but what I want is make this a function. func sortedKeys(m map[string]interface{}) { keys := make([]string, 0)

Re: [go-nuts] Re: how do I make my function always run at exit in `go test`?

2019-01-12 Thread 김용빈
Hmm.. I tested it again and it works today. I think it was just my problem. Sorry for the confusion and thank you! 2019년 1월 10일 목요일 오후 5시 25분 12초 UTC+9, Justin Israel 님의 말: > > > > On Thu, Jan 10, 2019, 9:14 PM 김용빈 > wrote: > >> Hi, Justin. Thank you for the response.

Re: [go-nuts] how do I make my function always run at exit in `go test`?

2019-01-10 Thread 김용빈
Yes, I am using TestMain. But signal.Notify is not helping me. 2019년 1월 10일 목요일 오후 2시 28분 10초 UTC+9, Justin Israel 님의 말: > > > > On Thu, Jan 10, 2019 at 6:24 PM 김용빈 > > wrote: > >> I tried signal.Notify but it seems it doesn't work. >> >> Then I find this:

Re: [go-nuts] Re: how do I make my function always run at exit in `go test`?

2019-01-10 Thread 김용빈
andler for SIGINT/SIGTERM also works > for me: > https://play.golang.org/p/93VmTTgE4YB > > Justin > > > On Thu, Jan 10, 2019 at 6:29 PM 김용빈 > > wrote: > >> Sorry I didn't clarify but I mean when it is killed/terminated. >> >> 2019년 1월 10일 목요일 오후 2시

[go-nuts] Re: how do I make my function always run at exit in `go test`?

2019-01-09 Thread 김용빈
Sorry I didn't clarify but I mean when it is killed/terminated. 2019년 1월 10일 목요일 오후 2시 24분 35초 UTC+9, 김용빈 님의 말: > > I tried signal.Notify but it seems it doesn't work. > > Then I find this: > https://github.com/golang/go/issues/15553#issuecomment-217162874 > > So what s

[go-nuts] how do I make my function always run at exit in `go test`?

2019-01-09 Thread 김용빈
I tried signal.Notify but it seems it doesn't work. Then I find this: https://github.com/golang/go/issues/15553#issuecomment-217162874 So what should I do to make my function always run at exit in test? -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Temporarily allow unused variables

2019-01-09 Thread 김용빈
package main func unused(x interface{}) {} func main() { a := 1 unused(a) } 2012년 3월 7일 수요일 오후 8시 32분 19초 UTC+9, Elazar Leibovich 님의 말: > > I sometimes have a very strange error, which I can't understand its source. > > One of my techniques for finding it, is isolate the problem to a

Re: [go-nuts] vim setup for auto go fmt on save.

2016-10-10 Thread 김용빈
Tank you Sander. I successfully installed and it works well. Still I want to know simple way though. If anyone knows about it, please let me know. :) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] vim setup for auto go fmt on save.

2016-10-10 Thread 김용빈
Hello, How could I achieve auto go fmt on save in vim? (with 2~3 lines of code) I don't want install entire plug-in like vim-go. Or is it better to do? Thank you. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this