Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread 刘桂祥
very thanks , I am unfamiliar with the cpu *out-of-order execution , but I doubt if my three line code is related ,it will reorder it ??* 在 2016年11月4日星期五 UTC+8下午1:38:12,Ian Lance Taylor写道: > > On Thu, Nov 3, 2016 at 10:28 PM, 刘桂祥 > > wrote: > > > > In my write goroutine I don't modify th

[go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-11-03 Thread andrewchamberss
I would also like to point out the extreme hypocrisy of saying Aram's comment is "unnecessary and insensitive" then labeling someone's thread as "bullying" (a pretty serious charge in todays climate). Both of which I would consider worse insults than saying someone has bad English. If i was on

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread Ian Lance Taylor
On Thu, Nov 3, 2016 at 10:28 PM, 刘桂祥 wrote: > > In my write goroutine I don't modify the map key (data structure) but set > the variable point to another map address ,this is a pointer assignment and > is atomic You're right, my previous reply was incorrect. My apologies. The real reason your

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread 刘桂祥
In my write goroutine I don't modify the map key (data structure) but set the variable point to another map address ,this is a pointer assignment and is atomic 在 2016年11月4日星期五 UTC+8下午1:22:20,Ian Lance Taylor写道: > > On Thu, Nov 3, 2016 at 10:19 PM, 刘桂祥 > > wrote: > > can you explain why w

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread Ian Lance Taylor
On Thu, Nov 3, 2016 at 10:19 PM, 刘桂祥 wrote: > can you explain why whis ? A map is basically a pointer to a complex data structure. Setting a value in a map changes that data structure. If one goroutine is reading from the data structure while a different goroutine is writing to the data struc

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread 刘桂祥
can you explain why whis ? 在 2016年11月4日星期五 UTC+8下午1:16:39,Ian Lance Taylor写道: > > On Thu, Nov 3, 2016 at 8:37 PM, 刘桂祥 > > wrote: > > // example.go > > > > package main > > > > var gMap = make(map[int]int) > > > > func w() { > > temp := make(map[int]int) > > temp[1] = 100 > >

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread Ian Lance Taylor
On Thu, Nov 3, 2016 at 8:37 PM, 刘桂祥 wrote: > // example.go > > package main > > var gMap = make(map[int]int) > > func w() { > temp := make(map[int]int) > temp[1] = 100 > temp[2] = 200 > gMap = temp// Does the compiler or cpu will reorder temp[1]=100, > temp[2]=200, gMap=temp ??

[go-nuts] Re: With GO - Can I say Procedural is better than OO?

2016-11-03 Thread jeremy . deats
It is procedural programming with OO seasoning and there's nothing wrong with that for small projects and utilities. Would like to see some case studies on using Go on projects with exceptional large code bases. I really think the all tenants of OOP (encapsulation, inheritance and polymorphism)

[go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-11-03 Thread prades . marq
That's not up to you to judge if some comment is "harmless" or not. Because you're not the person the comment has been directed at. Something that might seem "harmless" to you might be perceived as insulting to someone else. Aram's comment was unnecessary and insensitive to say the least, it do

Re: [go-nuts] Context cancellation

2016-11-03 Thread Gustavo Niemeyer
Glad it's being useful, and indeed, that API looks familiar. Nice. On Nov 3, 2016 4:33 PM, "Chris Hines" wrote: > FWIW, I'm a big fan of gopkg.in/tomb.v2. For similar functionality using > contexts consider golang.org/x/sync/errgroup. > > On Wednesday, November 2, 2016 at 7:55:59 PM UTC-4, Gusta

[go-nuts] Re: ActiveState seeking Go community feedback

2016-11-03 Thread Nate Finch
I'm curious to know what Activestate plans to bring to the table that isn't already a part of the go distributions people can download off of golang.org. I see it mentions the distribution including "popular modules" (I presume it means packages)... but given how easy it is to just go-get pack

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-11-03 Thread 刘桂祥
sorry could you provide a complete example ? I try this but not find question package main import "time" type T struct{ x int } var global *T func f() { p := new(T) p.x = 1 global = p // "publish" the new T (racy!) } func g() { p := global if p != nil { // println(p.x) // may prin

[go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-03 Thread 刘桂祥
// example.go package main var gMap = make(map[int]int) func w() { temp := make(map[int]int) temp[1] = 100 temp[2] = 200 gMap = temp// Does the compiler or cpu will reorder temp[1]=100, temp[2]=200, gMap=temp ?? } func r() { local := gMap println(local[1], local[2])

Re: [go-nuts] Re: Float32 math and slice arithmetics using SIMD

2016-11-03 Thread 'simon place' via golang-nuts
> > > That's the sort of cheap checks that I had mind in the very first post > when I talked about "I envisaged a call to CPUID and then some bool tests > along the way to utilise SSE[2-4]/AVX[2] (or NEON on ARM) if available. All > in a static, portable package." Thanks for a good example of t

[go-nuts] fasthttp redirect control

2016-11-03 Thread Aliaksandr Valialkin
Just use Client.Do - https://godoc.org/github.com/valyala/fasthttp#Client.Do . It doesn't follow redirects, so you can inspect each response and decide whether to follow each redirect. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscr

[go-nuts] anyone using pkg-config on Windows?

2016-11-03 Thread Russ Cox
We would like to fix the behavior of cgo invoking pkg-config on Windows, for golang.org/issue/16455. From the failure in the report, it appears that pkg-config --libs printed the actual text "C:/Program Files (x86)/libgit2/lib" as part of its output, without any kind of escaping of the spaces in th

[go-nuts] Package Management Survey Results

2016-11-03 Thread Matt Farina
A couple months ago we had a package management survey. Since the survey closed the data has been fed into the package management committee. Now we are sharing the data, that was not asked to be kept private. This can be read at https://docs.google.com/document/d/15j_Q6RRX_LH6tu4DNDm-vAcWAUablq

[go-nuts] fasthttp redirect control

2016-11-03 Thread Francis
I would like to be able to use the fasthttp client. But I need to be able to control the redirect logic. Specifically I would like to limit the number of redirects and abort the request if it redirects to a specific host. I am able to do that using the `http.Client.CheckRedirect` function, but

Re: [go-nuts] Context cancellation

2016-11-03 Thread Chris Hines
FWIW, I'm a big fan of gopkg.in/tomb.v2. For similar functionality using contexts consider golang.org/x/sync/errgroup. On Wednesday, November 2, 2016 at 7:55:59 PM UTC-4, Gustavo Niemeyer wrote: > > You said the function would return whether it got cancelled or not, so I > assumed something like

Re: [go-nuts] Is this go gettable ? crypto/tls/generate_cert.go

2016-11-03 Thread mhhcbon
Hi, thanks, ok good to go then ! > And, it doesn't really work for local dev Yeah, I figured this out after some reading. Some resources explains it might be possible to work with letsencrypr for local domains, but the setup is complex (my taste) and adds additional maintenance. What i want t

Re: [go-nuts] golang closure variable

2016-11-03 Thread adonovan via golang-nuts
On Thursday, 3 November 2016 03:05:47 UTC-4, 刘桂祥 wrote: > > > package main > > import "time" > > func main() { > s := []int{100, 200} > println(&s) > go func() { > s[0] = 300 > s = []int{300, 400} > }() > time.Sleep(1 * time.Second) > } > > just curious about this ,can you help explain the assemb

Re: [go-nuts] plugin - How to open and lookup for interface implementation

2016-11-03 Thread Mateusz Dymiński
A, thanks a lot for your help and sorry for trivial question. To test the type assertion I should use following code: printerImpl, ok := p.(*printer.Printer) if !ok { panic("wrong type") } (*printerImpl).Print("test") I was trying to call the 'Print' func as *printerImpl.Print("test") no

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-03 Thread adonovan via golang-nuts
On Wednesday, 2 November 2016 11:24:38 UTC-4, Martin Steffen wrote: > > I meant more: the _terminology_ of being untyped may reflect an internal > treatment of how the go compiler treats > those things: inside the go-compiler, the ``static phase''/type > checker/type inferencer may treat > for i

[go-nuts] Missing test flags (coverpkg and covermode) while running test binary

2016-11-03 Thread Vivekanand SV
Hi, I have a setup where I first generate binary and then run the binary for the test cases. I was able to do that successfully for basic things, but when I want to pass the coverpkg flag to the binary it doesn't work as it is not defined. I can see only coverprofile is defined while cover

Re: [go-nuts] plugin - How to open and lookup for interface implementation

2016-11-03 Thread David Crawshaw
The Lookup method is returning a pointer to the symbol (That way the program can modify the value of Impl through the plugin.) I believe you can write: printerImpl := *p.(*printer.Printer) On Thu, Nov 3, 2016 at 9:44 AM, Ian Lance Taylor wrote: > [ +crawshaw ] > > On Thu, Nov 3, 2016 at 12:51 A

Re: [go-nuts] Is this go gettable ? crypto/tls/generate_cert.go

2016-11-03 Thread Diego Medina
> > > Back on my original question, its ok if i copy paste the code into a > specific module with its appropriate credits ? > Given the quick red i gave it, there s really not much to change to this > code, it if works already. > > at the top of that file it says : // Use of this source code is

Re: [go-nuts] plugin - How to open and lookup for interface implementation

2016-11-03 Thread Ian Lance Taylor
[ +crawshaw ] On Thu, Nov 3, 2016 at 12:51 AM, Mateusz Dymiński wrote: > Hi, > > I am trying to load dynamically implementation of particular interface. I've > created the example in following repo: > https://github.com/mateuszdyminski/go-plugin > > I have interface - let's call it Printer: > pac

[go-nuts] plugin - How to open and lookup for interface implementation

2016-11-03 Thread Mateusz Dymiński
Hi, I am trying to load dynamically implementation of particular interface. I've created the example in following repo: https://github.com/mateuszdyminski/go-plugin I have interface - let's call it Printer: package printer type Printer interface { Print(text string) } And implementation of t

Re: [go-nuts] Is this go gettable ? crypto/tls/generate_cert.go

2016-11-03 Thread mhhcbon
Hi, thanks for feedback. The goal is to have a binary to generate self signed certificate in an instant. That i also want to provide installers, is because (its my sauce) I believe there s a world beyond go community to whom go wonders can be helpful this is an easy goal to reach because go is

Re: [go-nuts] Is this go gettable ? crypto/tls/generate_cert.go

2016-11-03 Thread Jan Mercl
On Thu, Nov 3, 2016 at 1:40 PM wrote: > to provide support for got get, windows/debian/rpm installers ? I probably do not understand the goal correctly, but: If the user can do `go get` then he has the go tool installed. That means he has Go installed. That means he does not have to go get the

[go-nuts] Is this go gettable ? crypto/tls/generate_cert.go

2016-11-03 Thread mhhcbon
Hi, I d like to know if i can go get this bin available here : https://golang.org/src/crypto/tls/generate_cert.go I think i can not, but i d like to be sure. If that is not go gettable, is there any problem if i re pack this into a specific module to provide support for got get, windows/debia

Re: [go-nuts] Re: Float32 math and slice arithmetics using SIMD

2016-11-03 Thread Ondrej
On Thursday, 3 November 2016 01:40:29 UTC, Nigel Tao wrote: > > > Another ignorant question from me, but what do you mean exactly by > universal binary? > Apologies for the confusing and nonsensical term. What I meant was a binary that works for a number of CPUs within an architecture, with or

Re: [go-nuts] golang closure variable

2016-11-03 Thread 刘桂祥
package main import "time" func main() { s := []int{100, 200} println(&s) go func() { s[0] = 300 s = []int{300, 400} }() time.Sleep(1 * time.Second) } just curious about this ,can you help explain the assemble code here "".main t=1 size=241 args=0x0 locals=0x28 0x 0 (main.go:5) TEXT "