Re: [go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-10 Thread Houzuo Guo
Thanks very much Ian! Kind regards, Howard On Tue, 11 Jun 2019 at 08:32, Ian Lance Taylor wrote: > > On Mon, Jun 10, 2019 at 10:23 PM Houzuo Guo wrote: > > > > Here's a complete example constructed from the snippets: > > > > - > > package main > > > > type Fun func() >

Re: [go-nuts] cgo behaviour change between go1.11.10 and go1.12.5

2019-06-10 Thread Ian Lance Taylor
On Mon, Jun 10, 2019 at 9:14 PM Neil Schellenberger wrote: > > When upgrading our build container from 1.11.10 to 1.12.5, some of our tests > failed in a surprising way. I've boiled down the issue to this short example > code fragment. > > package main > > // #include > // struct S { unsigned

Re: [go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-10 Thread Houzuo Guo
Hello Ian. Here's a complete example constructed from the snippets: - package main type Fun func() type Alpha struct { } func (a Alpha) funA() { } type Beta struct { } func (b Beta) funB() { } var a1,a2,a3,a4,a5 Alpha var b1,b2,b3,b4,b5 Beta var f Fun func main() { f

Re: [go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-10 Thread Ian Lance Taylor
On Mon, Jun 10, 2019 at 10:23 PM Houzuo Guo wrote: > > Here's a complete example constructed from the snippets: > > - > package main > > type Fun func() > type Alpha struct { > } > func (a Alpha) funA() { > } > > type Beta struct { > } > func (b Beta) funB() { > } > > var

Re: [go-nuts] how to prevent go1.13 go directive being written in an go directive-free go.mod?

2019-06-10 Thread Dan Kortschak
The semantics of the directive are not defined, and there are comments like this[1] that would introduce breakage for people who target more than one version of Go. Which version do we choose to write? Gonum support latest and two previous versions. We have had to write go 1.10 into that line so

[go-nuts] cgo behaviour change between go1.11.10 and go1.12.5

2019-06-10 Thread Neil Schellenberger
Hi Folks, When upgrading our build container from 1.11.10 to 1.12.5, some of our tests failed in a surprising way. I've boiled down the issue to this short example code fragment. package main // #include // struct S { unsigned char data[18]; }; import "C" import "unsafe" func main() { var

Re: [go-nuts] how to prevent go1.13 go directive being written in an go directive-free go.mod?

2019-06-10 Thread Ian Lance Taylor
On Mon, Jun 10, 2019 at 9:56 PM Dan Kortschak wrote: > > The semantics of this line of go.mod is not described anywhere, but the > tool chain blithely writes it to a go.mod file when there is no go > directive present. > > Is there a way to mark the go.mod as go version-agnostic? No. But there

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

2019-06-10 Thread Rob Pike
"[T]he Heisenberg Uncertainty Principle says that you cannot measure something without changing it". Actually no, that is the Observer Paradox. The Heisenberg Uncertainty Principle states that the product of the uncertainty of complementary variables, such as momentum and position, can never be

[go-nuts] how to prevent go1.13 go directive being written in an go directive-free go.mod?

2019-06-10 Thread Dan Kortschak
The semantics of this line of go.mod is not described anywhere, but the tool chain blithely writes it to a go.mod file when there is no go directive present. Is there a way to mark the go.mod as go version-agnostic? -- You received this message because you are subscribed to the Google Groups

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

2019-06-10 Thread carl . menezes . aeroqual
Thank you. That was very informative. On Tuesday, June 11, 2019 at 12:29:16 PM UTC+12, David Skinner wrote: > > Back in 1988, I was tasked with a code review for what seems like 150 > programmers. Now I am very lazy, being a good programmer, I am willing to > spend all day automating a one

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

2019-06-10 Thread Marcin Romaszewicz
In my example in the previous email, I accidentally used a very old version of echo. If you use the latest ("github.com/labstack/echo/v4"), then it's a lot faster than using simple string splitting, resulting in about 22,000 requests per second. Concurrency Level: 100 Time taken for tests:

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

2019-06-10 Thread 'Axel Wagner' via golang-nuts
On Mon, Jun 10, 2019 at 11:28 PM Tong Sun wrote: > There is a second test well before your this post, which is a direct > translation of Perl code, that is now reading and writing directly to > a socket. Hanging on to the first test method and not referring to the > second test is not a very

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

2019-06-10 Thread Tong Sun
Thanks a lot for all your help Marcin! Your expertise makes a total difference here! Double-thumbs up! On Mon, Jun 10, 2019 at 7:46 PM Marcin Romaszewicz wrote: > > In my example in the previous email, I accidentally used a very old version > of echo. If you use the latest

Re: [go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-10 Thread Ian Lance Taylor
On Sun, Jun 9, 2019 at 10:17 PM Houzuo Guo wrote: > > Thanks very much Ian - indeed I should have proof read the message. With the > last paragraph, I wished to ask for a way to tell a non-nil ` var f Fun` is > assigned to `funA` of any instance of structure Alpha, or `funB` of any > instance

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

2019-06-10 Thread Marcin Romaszewicz
One more followup. Here's an example using an HTTP router named Echo, which I use in production. With proper HTTP parsing and validation, and no regular expressions involved in routing, it still does about 14,000 requests per second. I stubbed some of your stuff which doesn't affect the result.

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

2019-06-10 Thread Marcin Romaszewicz
I think the others were correct in pointing the finger at the RegEx engine in Go. It is quite slow. I hacked your inside loop which checks the request not to use regular expressions, and it's tons faster. You can't say that something can't be responsible for too much slowdown because it "1 line",

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

2019-06-10 Thread Ian Lance Taylor
On Mon, Jun 10, 2019 at 7:44 AM Nitish Saboo wrote: > > Does the successful compilation makes sure that the Go code is properly > linked to the C header files ? I'm sorry, I don't know how to answer that question. Does your program run as expected? The `ldd` program will show the set of

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

2019-06-10 Thread Tong Sun
Just to clarify some facts. On Sun, Jun 9, 2019 at 11:09 AM 'Axel Wagner' wrote: > > As I've also mentioned: I don't think this test is meaningful. > > First, as it has been pointed out, your Perl program isn't actually a web > server. It only understands ridiculously simple requests and as such

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

2019-06-10 Thread David Skinner
Back in 1988, I was tasked with a code review for what seems like 150 programmers. Now I am very lazy, being a good programmer, I am willing to spend all day automating a one hour job. They were all using an in house OOPS language. I performed a cluster analysis of metrics using a Comal

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

2019-06-10 Thread Tong Sun
On Mon, Jun 10, 2019 at 7:50 PM Axel Wagner wrote: > > > > On Mon, Jun 10, 2019 at 11:28 PM Tong Sun wrote: >> >> There is a second test well before your this post, which is a direct >> translation of Perl code, that is now reading and writing directly to >> a socket. Hanging on to the first

[go-nuts] how to access request data using global variable -- help

2019-06-10 Thread afriyie . abraham
I have this simple http server. How can i access the request data to a global variable and use it in any other part of my application (example in different function). package main import ( "io" "net/http") var data string // Get http request URL data globally and use it in other

Re: [go-nuts] Allow methods on primitives

2019-06-10 Thread Jesper Louis Andersen
On Mon, Jun 10, 2019 at 8:11 AM Michael Jones wrote: > I miss discriminated unions too. (Fancy new name, “sum types”). > They are called sum types because they work as an "addition" like construction in the type theory. Their dual, product types, are what people usually call records or structs

Re: [go-nuts] how to access request data using global variable -- help

2019-06-10 Thread Jesper Louis Andersen
Hi! There is a fundamental thing you got to grok in Go, which is that the program is concurrent. If you have many requests to your server at the same time, they'll all try to write to your global `data`. This is called a data race, and it leads to all kinds of undefined behavior. You are not even

Re: [go-nuts] Allow methods on primitives

2019-06-10 Thread Jan Mercl
On Mon, Jun 10, 2019, 13:07 Jesper Louis Andersen < jesper.louis.ander...@gmail.com> wrote: > At some point, it is going to be "generally accepted" at which point > languages without sum types are going to be regarded as a relic of the > past. > I hope to be dead for a long time then. Don't get

Re: [go-nuts] Allow methods on primitives

2019-06-10 Thread Michael Jones
The Go2 proposal process is open minded. Suggest that every well-considered suggestion be made. Personally, I’m no fan of idiomatic as an argument, it seems more of a consequence—like bare earth paths worn through grassy parks—when the paved sidewalks are in the wrong place, the idiomatic path

Re: [go-nuts] Allow methods on primitives

2019-06-10 Thread Jesper Louis Andersen
On Mon, Jun 10, 2019 at 1:34 PM Jan Mercl <0xj...@gmail.com> wrote: > > > On Mon, Jun 10, 2019, 13:07 Jesper Louis Andersen < > jesper.louis.ander...@gmail.com> wrote: > >> At some point, it is going to be "generally accepted" at which point >> languages without sum types are going to be regarded

[go-nuts] Elastic Search with GO lang

2019-06-10 Thread sayoojmandodi
Hi guys. I want push the some events to redislab(using go lang) ... using elastic search i need to filter those events What are the tool required for this. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

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

2019-06-10 Thread Nitish Saboo
Hi Ian, Does the successful compilation makes sure that the Go code is properly linked to the C header files ? Thanks, Nitish On Sat, Jun 8, 2019 at 12:21 PM Nitish Saboo wrote: > Hi Ian, > > So I observed a very strange thing.If I leave it out completely then also > the project gets

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

2019-06-10 Thread Nitish Saboo
Hi Ian On Sat, Jun 8, 2019 at 12:21 PM Nitish Saboo wrote: > 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

Re: [go-nuts] Allow methods on primitives

2019-06-10 Thread Burak Serdar
On Mon, Jun 10, 2019 at 9:10 AM Jesper Louis Andersen wrote: > > > > On Mon, Jun 10, 2019 at 1:34 PM Jan Mercl <0xj...@gmail.com> wrote: >> >> >> >> On Mon, Jun 10, 2019, 13:07 Jesper Louis Andersen >> wrote: >>> >>> At some point, it is going to be "generally accepted" at which point >>>

Re: [go-nuts] Elastic Search with GO lang

2019-06-10 Thread Bob Strecansky
The olivere/elastic package will help you filter these events in a way that's helpful. See: https://github.com/olivere/elastic for more details. There are a couple great examples within that repo that should help. On Mon, Jun 10, 2019 at 10:45 AM wrote: > Hi guys. > > I want push the

Re: [go-nuts] Re: Go 1.8 port to FreeBSD/PowerPC64

2019-06-10 Thread Curtis Hamilton
I’ve resolved my issue and now have a working copy of Go. Unfortunately, this version (1.8.7) is the last version that openly supports Power5. Mikael Urankar has ported 1.12.5 to PowerPC64, however, when I attempt to build this version I encounter “illegal instruction”, indicating that