[go-nuts] Re: Does anyone know how to implement dynamic two-dimensional arrays ??

2019-04-21 Thread Miki Tebeka
Apart from writing your own, you might want to take a look at gonum - https://godoc.org/gonum.org/v1/gonum/mat On Sunday, April 21, 2019 at 8:10:40 AM UTC+3, lgo...@gmail.com wrote: > > Here's the snippet I'm trying to run > > package main > import ( "fmt" ) > > func main() { > Af(5) > } > > fun

[go-nuts] Mutual tls example

2019-04-21 Thread Vasiliy Tolstov
Hi, I'm try to find mutual tls example in go, but can't find simple example that uses crypto/tls. I need server that for some http handler for user request with token returns tls cert for communication, and client that uses this cert to communication after it returned from request. Ideally with abi

Re: [go-nuts] Mutual tls example

2019-04-21 Thread Aldrin Leal
I did a while ago, but I can't share a sample. But you can build one, provided that: 1. build your server as such (note the ClientAuth - thats where magic happens): ... rootCAs, _ := x509.SystemCertPool() if nil == rootCAs { rootCAs = x509.NewCertPool() }

[go-nuts] fmt.Fprint or io.WriteString for http.ResponseWriter write?

2019-04-21 Thread José Colón
Hi gophers! Is it better to (w is an http.ResponseWriter) fmt.Fprint(w, "Hello world") or to io.WriteString(w, "Hello world") or doesfmt.Fprint use io.WriteString behind the scenes, and thus they are equivalent? -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Does anyone know how to implement dynamic two-dimensional arrays ??

2019-04-21 Thread lgodio2
Burak Marcin and Miki : Many thanks, my problem is solved thanks to your comments On Sunday, April 21, 2019 at 1:10:40 AM UTC-4, lgo...@gmail.com wrote: > > Here's the snippet I'm trying to run > > package main > import ( "fmt" ) > > func main() { > Af(5) > } > > func Af ( N int) { > > //var

Re: [go-nuts] fmt.Fprint or io.WriteString for http.ResponseWriter write?

2019-04-21 Thread Christian Staffa
When you check out the source code both, fmt.Fprint and io.WriteString, need a writer as the first argument. Writer is an interface type which provides an Write method. And thats exactly what that functions are calling.. the Write method of your provided w (which is http.ResponseWriter in your c

Re: [go-nuts] Mutual tls example

2019-04-21 Thread Vasiliy Tolstov
Thank you, may be i find mode detailed example https://diogomonica.com/2017/01/11/hitless-tls-certificate-rotation-in-go/amp/ вс, 21 апр. 2019 г. в 15:22, Aldrin Leal : > > I did a while ago, but I can't share a sample. But you can build one, > provided that: > > 1. build your server as such (not

[go-nuts] Go+ replacement

2019-04-21 Thread icod . dalu
I don't know about you but for me, even if there wasn't so much going on, Google+ and the Go+ community was a source of info. Reddit is reddit, this whatever it is, is what it is, mewe can't replace G+. Facebook just isn't the crowd. Xing and the like just aren't made to handle the task of s

[go-nuts] Does fmt.Fprint use WriteString ?

2019-04-21 Thread codiglot
Hi gophers! Just wondering if in a Handler I should (w is the http.ResponseWriter): fmt.Fprint(w, "Hello world") or is it better to io.WriteString(w, "Hello world") or is it the same if fmt.Fprint already uses WriteString internally? -- You received this message because you are subscribed t

[go-nuts] Re: floating point question

2019-04-21 Thread lgodio2
I think michael Jones ' explanation is correct...when we x : =1.3 Go translates this to a binary representation of 1.3 that is a very close approximation to decimal 1.3 so when you do fmt.Printf( "\n %v ", x) you get the the binary version of x translated back to decimal, which will not be exa

Re: [go-nuts] Go+ replacement

2019-04-21 Thread Dan Kortschak
This is unfortunate. It was less like that in the past. On Sun, 2019-04-21 at 18:02 -0700, icod.d...@gmail.com wrote: > Nuts is more of a "help I have a problem" thing. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gro

[go-nuts] go execution speed for float64 based calculations vs float32

2019-04-21 Thread lgodio2
?? On 64-bit CPUs does anyone have any experience comparing the run-time speed of float64 based calculations vs float32 ? Some of my C-code when translated to Go-code seems to run noticeably slower, so I'm wondering if I can speed things up by converting float vars to float32 vs float64 -- Y

Re: [go-nuts] go execution speed for float64 based calculations vs float32

2019-04-21 Thread Robert Engels
At least on intel, float64 should be faster than float32 since all math is done on the fpu in 64 bits, so it needs to be converted, but the memory bus also comes into play. I would doubt it. Float32 is designed for size not performance. > On Apr 21, 2019, at 8:55 PM, lgod...@gmail.com wrote:

[go-nuts] go build *.exe file size seems much too large

2019-04-21 Thread lgodio2
For this simple go code, the *.exe file size is 1800 KB ...why so large compared to equivalent C-compiled code ?? package main import( "math"; "fmt" ) func main() { fmt.Printf("\n %8.3f", math.Sin(1.2) ) } Does the go generated *.exe file contain code only for math.Sin() or all the functions that

Re: [go-nuts] go build *.exe file size seems much too large

2019-04-21 Thread Marcin Romaszewicz
It contains the Go runtime - memory manager, goroutine scheduler, all that. -- Marcin On Sun, Apr 21, 2019 at 7:16 PM wrote: > For this simple go code, the *.exe file size is 1800 KB ...why so large > compared to equivalent C-compiled code ?? > package main > import( "math"; "fmt" ) > func mai

Re: [go-nuts] go build *.exe file size seems much too large

2019-04-21 Thread andrey mirtchovski
the go runtime (bare, nothing else) is about 1.1MB now. the "fmt" package brings almost a MB of dependencies including 800 or so unicode-related functions (names/symbols), reflection, etc. the math package brings almost nothing: 11 symbols. -8< $

Re: [go-nuts] binary.Read cgo fields

2019-04-21 Thread Ian Lance Taylor
On Sat, Apr 20, 2019 at 11:53 AM wrote: > > binary.Read can't set unexported fields, right? > But my structs are defined in C, and I can't make all C source code using > capital fields.. > What could I do? Read the fields separately. That is often a better idea in any case, as the result is mor

[go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Pat Farrell
I have a logic error in my calculation. I am getting -2147483648 in an int32 This sure looks a lot like MinInt32, but I can't seem to be able to tell, all my calculators want to blow up on -1 << 31 I'm willing to bet that my value is +/- one from whatever MinInt32 is in decimal form. Is this c

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Skip Tavakkolian
Use Ivy? On Sun, Apr 21, 2019, 8:36 PM Pat Farrell wrote: > I have a logic error in my calculation. I am getting -2147483648 in an > int32 > This sure looks a lot like MinInt32, but I can't seem to be able to tell, > all my calculators want to blow up on -1 << 31 > > > I'm willing to bet that

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread andrey mirtchovski
wolfram alpha is a good place to do numbers: https://www.wolframalpha.com/input/?i=-1+%3C%3C+31 if you're on a mac, the calculator has a "programmer mode" which allows arbitrary manipulations of bits. On Sun, Apr 21, 2019 at 9:36 PM Pat Farrell wrote: > > I have a logic error in my calculation.

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Kurtis Rader
On Sun, Apr 21, 2019 at 8:37 PM Pat Farrell wrote: > I have a logic error in my calculation. I am getting -2147483648 in an > int32 > This sure looks a lot like MinInt32, but I can't seem to be able to tell, > all my calculators want to blow up on -1 << 31 > > > I'm willing to bet that my value i

Re: [go-nuts] go build *.exe file size seems much too large

2019-04-21 Thread Ian Lance Taylor
On Sun, Apr 21, 2019 at 7:16 PM wrote: > > For this simple go code, the *.exe file size is 1800 KB ...why so large > compared to equivalent C-compiled code ?? > package main > import( "math"; "fmt" ) > func main() { > fmt.Printf("\n %8.3f", math.Sin(1.2) ) > } > Does the go generated *.exe file c

[go-nuts] Re: is -2147483648 the same as MinInt32

2019-04-21 Thread Pat Farrell
Thanks to all. I speak Linux and sadly Winders 10 these days. I do have a MacBookPro that I got for IOS development years ago, but its old and way too slow. My fundamental problem was a NaN. Added a check and all is fine. Thanks -- You received this message because you are subscribed to the Go

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Pat Farrell
On Sunday, April 21, 2019 at 11:50:38 PM UTC-4, Kurtis Rader wrote: > > On Sun, Apr 21, 2019 at 8:37 PM Pat Farrell > wrote: > >> I have a logic error in my calculation. I am getting -2147483648 in an >> int32 >> >> A 2s-complement 32-bit int by definition can represent the range > [-214748364

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Kurtis Rader
On Sun, Apr 21, 2019 at 9:02 PM Pat Farrell wrote: > On Sunday, April 21, 2019 at 11:50:38 PM UTC-4, Kurtis Rader wrote: >> >> On Sun, Apr 21, 2019 at 8:37 PM Pat Farrell wrote: >> >>> I have a logic error in my calculation. I am getting -2147483648 in an >>> int32 >>> >>> A 2s-complement 32-bit

Re: [go-nuts] go execution speed for float64 based calculations vs float32

2019-04-21 Thread lgodio2
I note that this issue has been dealt with in a previous post https://groups.google.com/forum/#!topic/golang-nuts/n12khle-mlY The gist of which seems to suggest that 32-bit is faster than 64 On Sunday, April 21, 2019 at 10:09:09 PM UTC-4, Robert Engels wrote: > > At least on intel, float64 shoul