Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
Hi Ian, So I observed a very strange thing.If I leave it out completely then also the project gets compiled. I thought that linker file is binding my Go code to the C code.Why am I not getting any error ? How the Go code is then getting linked to the C code ? Compiled Succesfully

Re: [go-nuts] There are post-quantum public key cryptograph in Go ? or binds to Go? Thanks.

2019-06-07 Thread Marcin Romaszewicz
The NIST publishes some recommendations for applied cryptography, and they've amended their recommendations recently away from some quantum-weak algorithms. Here's a good starting point for reading. Your biggest cryptography p

[go-nuts] Re: How to control go routine numbers in function call

2019-06-07 Thread Krzysztof Kowalczyk
See https://www.programming-books.io/essential/go/limiting-concurrency-with-a-semaphore-26ac6084d7404f7385e4eccaa3fd20de for one way that uses a channel as a semaphore to limit concurrency. On Friday, June 7, 2019 at 6:28:01 PM UTC-7, Joseph Wang wrote: > > Hi everyone > > I have a simple ques

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Ian Lance Taylor
On Fri, Jun 7, 2019 at 8:59 PM Nitish Saboo wrote: > > I have tried the following three scenarios and one of them compiles > successfully that is with -L option. > Let me know If am I missing something here . You should use what works, although I don't know why it works. I would have thought th

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
Hi Ian, I have tried the following three scenarios and one of them compiles successfully that is with -L option. Let me know If am I missing something here . *1)When I use the this I get the following error:* package lib //#cgo CFLAGS: -I./syslog-ng-3.6.2/ //#cgo LDFLAGS: ${HOME}/Documents/gowo

Re: [go-nuts] Re: How to control go routine numbers in function call

2019-06-07 Thread Michael Jones
Here’s a helper... https://github.com/korovkin/limiter/blob/master/README.md You can do it using several other mechanisms as well. On Fri, Jun 7, 2019 at 6:31 PM Joseph Wang wrote: > I mean at same time only 4 go routines run and then creat another 4 etc. > > On Fri, Jun 7, 2019 at 6:27 PM Jos

[go-nuts] Re: How to control go routine numbers in function call

2019-06-07 Thread Joseph Wang
I mean at same time only 4 go routines run and then creat another 4 etc. On Fri, Jun 7, 2019 at 6:27 PM Joseph Wang wrote: > Hi everyone > > I have a simple question about go routines. > > So I have a function like this > > Func1() { > > for n := range array { > go fun2() > } > } > >

[go-nuts] How to control go routine numbers in function call

2019-06-07 Thread Joseph Wang
Hi everyone I have a simple question about go routines. So I have a function like this Func1() { for n := range array { go fun2() } } So as I can not make sure array has a fix size, then I cannot control go routines number. Does any one have some elegant ways that I can limit this

Re: [go-nuts] There are post-quantum public key cryptograph in Go ? or binds to Go? Thanks.

2019-06-07 Thread Michael Jones
Your question is maybe a decade premature. Post-quantum cryptography, as in, “now that quantum encryption is here and understood, we have tools to build public key mechanisms provably safe for 50+ years in this post-quantum environment,” is mostly a sentence from the future. I have patents pending

[go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-07 Thread Ivan Bertona
Looking a the two code samples I wouldn't say this is an apples to apples comparison... The Perl script seems to be a simple single-threaded loop that understands a tiny subset of HTTP vs. a fully-fledged (and secure) web server from the Go standard library. I would definitely not run that Perl

Re: [go-nuts] Where is the body for sleep fucntion?

2019-06-07 Thread Ian Lance Taylor
On Fri, Jun 7, 2019 at 4:35 PM Kilts Ros wrote: > > Hi, i want to understand how do sleep function work but i didn't find his > body. Shall someone tell me where is his body? > > https://github.com/golang/go/blob/master/src/time/sleep.go#L9 https://golang.org/src/runtime/time.go#L82 Ian -- Yo

Re: [go-nuts] Go will shine on huge web projects, but how about simple ones?

2019-06-07 Thread Iwan Budi Kusnanto
Can you share your Go code? On Fri, Jun 7, 2019, 20:36 Tong Sun wrote: > I had always believed that the web projects build with Go should be much > faster than Perl, since Go is a compiled language. > > However that belief was crushed brutally last night, when I did a > comparison -- the Go impl

[go-nuts] Where is the body for sleep fucntion?

2019-06-07 Thread Kilts Ros
Hi, i want to understand how do sleep function work but i didn't find his body. Shall someone tell me where is his body? https://github.com/golang/go/blob/master/src/time/sleep.go#L9 thanks -- You received this message because you are subscribed to the Google Groups "golang-nut

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-07 Thread Anger
Yeah, you probably want to avoid fasthttp. Chi https://github.com/go-chi/chi and Gin https://github.com/gin-gonic/gin Are both better than the base httpserver and I've using them in large scale adtech deployments without issue. Also you can get BETTER performance out of the base http client (over

[go-nuts] There are post-quantum public key cryptograph in Go ? or binds to Go? Thanks.

2019-06-07 Thread Daniel Norte Moraes
HI! There are post-quantum public key cryptograph in Go ? or binds to Go? My need is just keys creation, encryption and decryption. Many Thanks in Advance! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this g

[go-nuts] Re: global var available in different files (same package)

2019-06-07 Thread jake6502
On Friday, June 7, 2019 at 2:12:22 PM UTC-4, Natxo Asenjo wrote: > > > > On Friday, June 7, 2019 at 6:07:09 PM UTC+2, jake...@gmail.com wrote: >> >> >> >> It is unclear what the problem is. Global variables will be accessible >> from any file that is part of package "main". As you said, you cou

Re: [go-nuts] Acquiring database new connections slow using pgx and pq

2019-06-07 Thread Ian Lance Taylor
On Fri, Jun 7, 2019 at 11:55 AM wrote: > > Yes, that's right. But I suspect that this is due to some > blocking/semaphoring in a core Go library. I don't know what the problem is here, but I would say that that is very unlikely. The Go standard library could always use more optimization, but it

[go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-06-07 Thread alanfo
Michal, Without wishing to over-complicate your proposal, I think you should at least consider adding "gen int" to the mix. The reason I say this is because the integer types support a lot more operators than the floating point and complex types do, namely: 1. The remainder operator (%). 2. T

Re: [go-nuts] Allow methods on primitives

2019-06-07 Thread Burak Serdar
On Fri, Jun 7, 2019 at 12:40 PM Michael Ellis wrote: > > Count me among those who love the language just the way it is and regard the > prospect Go 2.0 with dread and loathing born of the Python 3 experience. > > That being said, there's one itty-bitty change I'd like to advocate: Allow > method

Re: [go-nuts] Acquiring database new connections slow using pgx and pq

2019-06-07 Thread nafana
Yes, that's right. But I suspect that this is due to some blocking/semaphoring in a core Go library. -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed.  If you have received this email in er

Re: [go-nuts] In-Method declaration of array of struct literals vs global var?

2019-06-07 Thread 'Aaron Spangler' via golang-nuts
That makes so much more sense now. Thank you for the explanation! On Thu, Jun 6, 2019 at 7:07 PM Steven Blenkinsop wrote: > = is always required when you're assigning a value to the var. the > confusion might be that you can also have a declaration like > > var bar []struct{a, b, c string} > > w

[go-nuts] Allow methods on primitives

2019-06-07 Thread Michael Ellis
Count me among those who love the language just the way it is and regard the prospect Go 2.0 with dread and loathing born of the Python 3 experience. That being said, there's one itty-bitty change I'd like to advocate: *Allow methods on primitives*. I think I understand why allowing new meth

[go-nuts] Re: global var available in different files (same package)

2019-06-07 Thread Natxo Asenjo
On Friday, June 7, 2019 at 6:07:09 PM UTC+2, jake...@gmail.com wrote: > > > > It is unclear what the problem is. Global variables will be accessible > from any file that is part of package "main". As you said, you could > convert the strings in main(), then put them in some global variables, f

Re: [go-nuts] [48]byte should be make to empty

2019-06-07 Thread ivan . fraixedes
Or even just declare the var without any value assignation because it's zero value is an array of zero byte value, which is 0. var array [48]byte On Thursday, 6 June 2019 17:38:14 UTC+2, Michel Levieux wrote: > > Hi, > > It is not quite clear what you are trying to do, but if I understand it >

[go-nuts] Re: A good indicator of code quality

2019-06-07 Thread Michael Ellis
On Friday, June 7, 2019 at 12:01:40 PM UTC-4, jake...@gmail.com wrote: > > > I don't know the reasons why you want such metrics, but I would strongly > caution against equating any automated metric with "code quality". > Amen. To my mind the most useful metric is what a mentor of mine dubbed

Re: [go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-06-07 Thread Luis Furquim
Hi Burak, So, how about to change the idea to accept contracts as restrictions to generic types? For example: This is defined on https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md contract stringer(x T) { var s string = x.String()} Could be expressed this way: t

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Ian Lance Taylor
On Fri, Jun 7, 2019 at 9:53 AM Nitish Saboo wrote: > > > //#cgo CFLAGS: -I./syslog-ng-3.6.2/ > > //#cgo LDFLAGS: -L$(SRCDIR)/syslog-node.so. < > > Is this what you are saying? > Btw..do I need to keep -L flag? I'm suggesting that you try //#cgo LDFLAGS: ${SRCDIR}/syslog-node.so

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
Hi Ian, > //#cgo CFLAGS: -I./syslog-ng-3.6.2/ > //#cgo LDFLAGS: -L$(SRCDIR)/syslog-node.so. < Is this what you are saying? Btw..do I need to keep -L flag? Thanks, Nitish On Fri, 7 Jun 2019, 19:07 Ian Lance Taylor, wrote: > On Fri, Jun 7, 2019 at 4:03 AM Nitish Saboo > wrote:

[go-nuts] Re: global var available in different files (same package)

2019-06-07 Thread jake6502
On Thursday, June 6, 2019 at 3:07:22 PM UTC-4, Natxo Asenjo wrote: > > hi, > > I'd like to define a couple of global variables in a small cli app. The > app has a few files but it's not large. > > What I'd like is to use cli flags to define options, and those options > should be available for a

[go-nuts] Re: A good indicator of code quality

2019-06-07 Thread jake6502
On Thursday, June 6, 2019 at 3:58:19 PM UTC-4, Carl wrote: > > I'd like to know what people are using to measure the quality of their Go > code bases and why. Specifically, I'm asking if: > >1. There is a way to score a code base on quality that works with >idiomatic Go >2. Use this m

Re: [go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-06-07 Thread Burak Serdar
On Fri, Jun 7, 2019 at 7:32 AM Luis Furquim wrote: > > > > Hello gophers, > > I have almost no experience on language definitions/proposals and on generics. > But an idea came to my mind and I wanted to share it. > It is an idea, not a proposal, I haven't worked on detailing/elaboration, etc. > As

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-07 Thread Burak Serdar
On Fri, Jun 7, 2019 at 9:01 AM Ronny Bangsund wrote: > > Yes, the built-in is pretty awful in many ways. There are fortunately lots of > alternatives, all with roughly an order of magnitude better performance. I > inspected this list yesterday to finally make a choice of packages to use: > http

[go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-07 Thread Ronny Bangsund
Yes, the built-in is pretty awful in many ways. There are fortunately lots of alternatives, all with roughly an order of magnitude better performance. I inspected this list yesterday to finally make a choice of packages to use: https://github.com/smallnest/go-web-framework-benchmark I ended up

Re: [go-nuts] Re: Want to know differance between two code snippets defined here

2019-06-07 Thread Burak Serdar
In line 31 you are redeclaring dispatchMux instead of assigning to the global dispatchMux. That still doesn't explain why it is not working when you do it with a function, but maybe there's something else not included in your posted code. On Thu, Jun 6, 2019 at 11:40 PM Manish Champaneri wrote: >

Re: [go-nuts] Acquiring database new connections slow using pgx and pq

2019-06-07 Thread Michael Jones
Are you saying that it takes 7 seconds to make a connection? On Thu, Jun 6, 2019 at 5:26 PM wrote: > I noticed that when executing concurrent db queries against my Postgres > db, the response time gets slower linearly with the number of goroutines > (at the order of O(N)). The first connection o

Re: [go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Ian Lance Taylor
On Fri, Jun 7, 2019 at 4:03 AM Nitish Saboo wrote: > > //#cgo CFLAGS: -I./syslog-ng-3.6.2/ > //#cgo LDFLAGS: syslog-node.so. < Try using ${SRCDIR}/syslog-node.so, since you are creating the shared library in the source directory. Ian -- You received this message because you ar

[go-nuts] Go will shine on huge web projects, but how about simple ones?

2019-06-07 Thread Tong Sun
I had always believed that the web projects build with Go should be much faster than Perl, since Go is a compiled language. However that belief was crushed brutally last night, when I did a comparison -- the Go implementation is *8 times worse

[go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-06-07 Thread Luis Furquim
Hello gophers, I have almost no experience on language definitions/proposals and on generics. But an idea came to my mind and I wanted to share it. It is an idea, not a proposal, I haven't worked on detailing/elaboration, etc. As stated on my gist, I got the text and examples from Faiface gi

Re: [go-nuts] Creating HTTP API with extra '/' (without quotes) at the end of the route, takes only 'GET' request.

2019-06-07 Thread Ben Burwell
If I am correctly understanding the situation you're describing, I think this actually may be a bug with Postman. I ran your code (removed the unused imports) with the trailing slashes, then I used curl to make a request to /stats: ~ curl -v -L -X POST http://localhost:5000/stats * Tryi

Re: [go-nuts] Creating HTTP API with extra '/' (without quotes) at the end of the route, takes only 'GET' request.

2019-06-07 Thread Steven Hartland
I believe this is documented here: https://golang.org/pkg/net/http/#ServeMux On 07/06/2019 07:46, Mayank Gupta wrote: Hi All, I wanted to make sure before filing an issue on Github. Here's the code using net/http package to create a restful web API. If I hit any route using Postman app, no matte

[go-nuts] Creating HTTP API with extra '/' (without quotes) at the end of the route, takes only 'GET' request.

2019-06-07 Thread Mayank Gupta
Hi All, I wanted to make sure before filing an issue on Github. Here's the code using net/http package to create a restful web API. If I hit any route using Postman app, no matter the type of request (POST, PUT, DELETE, etc.) it always hits the API as a GET request. package main import ( "

[go-nuts] Need Assistance: makefile failing at 'go build' step

2019-06-07 Thread Nitish Saboo
Hi, syslogparse.go --- *** package lib //#cgo CFLAGS: -I./syslog-ng-3.6.2/ //#cgo LDFLAGS: syslog-node.so. < //#cgo LDFLAGS: -L/usr/local/lib/ -lsyslog-ng //#cgo LDFLAGS: -L/usr/local/lib/syslog-ng -ldbparser //#cgo pkg-co

Re: [go-nuts] Creating a request language from scratch

2019-06-07 Thread Michel Levieux
Thx, I'm gonna have a look at this :) Le ven. 7 juin 2019 à 10:12, Rob Pike a écrit : > Some minor advice: > > > https://commandcenter.blogspot.com/2011/08/regular-expressions-in-lexing-and.html > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts"

Re: [go-nuts] Creating a request language from scratch

2019-06-07 Thread Rob Pike
Some minor advice: https://commandcenter.blogspot.com/2011/08/regular-expressions-in-lexing-and.html -- 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+