Re: [go-nuts] differences between pointer and value slice in for-range loop

2016-09-17 Thread Fei Ding
Thanks, Marvin, I've learned a lot from your reply. And, I've written more code, like: a, b, c := 1, 2, 3 > slice1 := []int{a, b, c} > for _, n := range slice1 { > go func(n *int) {fmt.Println(*n)}(&n) > } It seems that pass *n's address *in the code above will make a data race, which you have

[go-nuts] truncate float32 to lesser precision (22 bit mantissa)

2016-09-17 Thread xiiophen
ok I have a problem with rounding errors on floats which I think is unavoidable. Just as specific background this is happening for me on tests of vectors (lines) intersecting with bounding boxes (ie oblongs, axis aligned). Two code snippets shows the core of the maths.. front_n = (x_front - s.X

Re: [go-nuts] Support of diffie-hellman-group-exchange-sha1

2016-09-17 Thread Matt Harden
Why use that when ecdh is apparently more secure? https://weakdh.org/ On Wed, Sep 7, 2016 at 11:45 PM FY wrote: > Hello, > > Am I missing something ? > > I am trying to use the exchange algorithm called > "diffie-hellman-group-exchange-sha1" It looks like Go does not support it > > > From this l

Re: [go-nuts] Re: The site at localhost:1234 can't be reached.

2016-09-17 Thread Dave Cheney
Yes. The bottom. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/op

Re: [go-nuts] Re: The site at localhost:1234 can't be reached.

2016-09-17 Thread Marvin Renich
* Dave Cheney [160917 15:58]: > Move http.ListenAndServe to the top of the main() function, outside the > http.HandleFunc call and it will work. Don't you mean bottom? At the top, the ListenAndServe will not return, so the HandleFunc call will never be made, so you will always get 404. ...Marv

Re: [go-nuts] Abridged summary of golang-nuts@googlegroups.com - 24 updates in 11 topics

2016-09-17 Thread Jonathan Lawlor

[go-nuts] Re: reflect, is it possible to get the [body + sign] of a func as text at runtime ?

2016-09-17 Thread aroman
Use the Type: reflect.Value.Type.String: https://play.golang.org/p/dlwjCROG6H On Saturday, September 17, 2016 at 3:53:35 AM UTC-7, mhhcbon wrote: > > Hi, > > i m wondering if one can use reflect to extract at runtime the body and > and signature of a Func or 'Public method' ? > Will a reflect.Va

[go-nuts] Re: The site at localhost:1234 can't be reached.

2016-09-17 Thread Dave Cheney
Move http.ListenAndServe to the top of the main() function, outside the http.HandleFunc call and it will work. On Sunday, 18 September 2016 05:50:03 UTC+10, loc...@gmail.com wrote: > > Hello everyone, > > I am using Go version 1.7.1 on a 32-bit version of Windows 10 and cannot > view the content

Re: [go-nuts] The site at localhost:1234 can't be reached.

2016-09-17 Thread Shawn Milochik
The ListenAndServe shouldn't be in the handler function. When you run this app, does it exit immediately? Because it looks like it exits immediately. Not serving anything. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Websocket's (RFC6455) fate after HTTP/2??

2016-09-17 Thread Srivathsan Madhavan
Hi all, My apologies; I very well understand that the answers to my question here could be subjective / opinions yet I would like to know if I could really continue banking on this Websockets. I feel Websockets is really cool and I have used it for IPC between non-web applications. Certainly

[go-nuts] Re: how to restrict the program run only one instance

2016-09-17 Thread Rodolfo Amaral
I know this topic is a bit old, but I needed it recently on Windows and I'll post here how I did it in case someone else needs. I used Windows mutex as described by ankurg...@gmail.com: var ( kernel32= syscall.NewLazyDLL("kernel32.dll") procCreateMutex = kernel32.NewProc("CreateM

[go-nuts] The site at localhost:1234 can't be reached.

2016-09-17 Thread lochbm
Hello everyone, I am using Go version 1.7.1 on a 32-bit version of Windows 10 and cannot view the contents of the address localhost:1234. I created a server at the aforementioned address or at least, I think I did and get nothing but an error message when I try to open my browser. Here's my co

[go-nuts] http2 and TSL handshake errors

2016-09-17 Thread gobright
My Go application has both standard http (on port 80) and SSL (on port 443) enabled. I continuously get these 3 kinds of error: *http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface* *http: TLS handshake error from 151.38.29.250:44235: EOF* *

Re: [go-nuts] differences between pointer and value slice in for-range loop

2016-09-17 Thread Marvin Renich
* Fei Ding [160916 23:30]: > Link here: https://play.golang.org/p/cdryPmyWt5 > > The code above is going to check the differences between pointers and > values in a for loop, while go statement is also used at the same time. For > code: > > values := []field{{"one"},{"two"},{"three"}} >

[go-nuts] Re: How the main func started?

2016-09-17 Thread peterGo
dc0d, It's implementation dependendent. Be explicit. For example, pass a flag argument, *//go:generate go run main.go -gogenerate* Peter On Saturday, September 17, 2016 at 9:28:16 AM UTC-4, dc0d wrote: > > How to find out if the *main* function is started by executing the > compiled binary or

[go-nuts] How the main func started?

2016-09-17 Thread dc0d
How to find out if the *main* function is started by executing the compiled binary or by *go run*? By examining *os.Args* it can be seen at the first case (running the app) we will have the *binary name* as the first argument without any path and when it is started using go run, we will have so

[go-nuts] Re: text/template and preserving new lines from a struct field

2016-09-17 Thread Joseph Lorenzini
Actually, the issue is not the template but my logger. The logger is writing to os.Stderr for some reason that's not preserving new lines but if i do fmt.Println then the new lines are preserved. Pretty sure i've made a simple error here and need to investigate more. Joe On Saturday, Septem

[go-nuts] text/template and preserving new lines from a struct field

2016-09-17 Thread Joseph Lorenzini
Hi all, Say I have the following struct: type Info struct { Summary string Descstring } And this is the template string tmplStr = `Summary={{.Summary}}, Desc={{.Desc}}` If the value of Desc has newlines, it looks like the template engine strips those out and replaces th

Re: [go-nuts] How to deal with "Expect: 100-continue" *without* sending a 100 status

2016-09-17 Thread Ian Rose
Thanks Dave - all good suggestions! > Use a GCE Network LB instead of HTTP LB. I'm hoping to avoid using a network LB since we are operating over https so that means we'll have to terminate SSL ourselves (which means distributing our certs to each backend instance). Using an http(s) LB means we

[go-nuts] Re: Why + and += operators for string but not slices?

2016-09-17 Thread oyi812
A slice shares enough properties with string to make + intuitive. [a, b, y, z] = [a, b] + [y, z] // make() and copy() To me the ++ operator (and +=) operator for slices are intuitive too. [a, b, c, d] = [a, b] ++ [c, d] // append(slice, slice...) An operator and composite literal combined wou

[go-nuts] Re: Why + and += operators for string but not slices?

2016-09-17 Thread johnroth1
On Friday, September 16, 2016 at 11:11:17 AM UTC-6, oyi...@gmail.com wrote: > > I have not been able to find an explanation. Does anyone care to explain > or point to relevant documentation? > One data point: I'd expect slice + slice to create a new object, that is, a new backing array. I'd al

[go-nuts] Re: differences between pointer and value slice in for-range loop

2016-09-17 Thread Marvin Stenger
Because print() is called on different pointer values. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options,

[go-nuts] reflect, is it possible to get the [body + sign] of a func as text at runtime ?

2016-09-17 Thread mhhcbon
Hi, i m wondering if one can use reflect to extract at runtime the body and and signature of a Func or 'Public method' ? Will a reflect.Value.String of a Method give me that data ? https://golang.org/pkg/reflect/#Method Will that work on a compiled binary ? (An environment where the raw source

[go-nuts] Re: Why + and += operators for string but not slices?

2016-09-17 Thread paraiso . marc
The more contextual a PL's semantics is the harder it is to make sense of a program written in that PL (the inverse is also true, that's why we don't program lining zeros and ones ) ... The problem with what you are asking is why yet another special case for slices ? why not one for channels ? w