[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

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

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: > >

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

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) > >

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,

[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

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

[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

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

[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],

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

[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

[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

[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

[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

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

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() > go func() { > s[0] = 300 > s = []int{300, 400} > }() > time.Sleep(1 * time.Second) > } > > just curious about this ,can you help explain the

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")

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

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

[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

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] 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() 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

Re: [go-nuts] golang closure variable

2016-11-03 Thread Ian Lance Taylor
On Wed, Nov 2, 2016 at 11:48 PM, 刘桂祥 wrote: > I just want to look what variable datastructure is passed to the closure > func but I am confused with the assemble code > > > // example.go > > package main > > > import "time" > > > func main() { > > s := []int{100, 200}

Re: [go-nuts] golang closure variable

2016-11-03 Thread 刘桂祥
I just want to look what variable datastructure is passed to the closure func but I am confused with the assemble code // example.go package main import "time" func main() { s := []int{100, 200} func() { s[0] = 300 s = []int{300, 400} }() time.Sleep(1 * time.Second) } And I

Re: [go-nuts] golang closure variable

2016-11-03 Thread Ian Lance Taylor
On Wed, Nov 2, 2016 at 8:03 PM, 刘桂祥 wrote: > > In golang closure func ,the needed outer variable is passed by reference > > but when the variable self is a reference in example.go , the closure func > paras is *[[int]int,...] is so ? I'm not completely sure what you