[go-nuts] Re: Migrating from a classic OO pattern

2017-01-31 Thread Wanton
First link in my first reply didn't use encapsulation. It gave Dog as parameter. Also not sure how golang internals work but when you encapsulate something thats probably new heap allocation. I know it's tempting to use OO patterns (classes) but golang has very powerful interface system and I

[go-nuts] Should an input validation function correct the input?

2017-01-31 Thread Tamás Gulácsi
I treat all code on pointer as it may modify the data, and use pointers sparingly. Maybe you could call it Correct instead of Verify, to be explicit. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Looking for a SQLite statement parser

2017-01-31 Thread Philip O'Toole
Great -- thanks for the reference, I'll take a look. Philip On Tue, Jan 31, 2017 at 10:02 AM, Vasiliy Tolstov wrote: > cznic/ql have own lexer for SQL and it syntax very similar. > > 31 Янв 2017 г. 16:33 пользователь написал: > >> Hello, >> >> I am

Re: [go-nuts] Is there a reason go doesn't use the small string optomization

2017-01-31 Thread Ian Lance Taylor
On Tue, Jan 31, 2017 at 9:10 PM, Eliot Hedeman wrote: > I was writing up a proposal about adding the small string > optimization(putting strings on the heap if they will fit within the > sringStruct)to the go runtime, and I realized there might be good reason why > this

Re: [go-nuts] Re: How can I distribute incoming HTTP request to 5 asynchronous workers?

2017-01-31 Thread Sairam Kunala
If one incoming HTTP request should be sent to 5 workers async, See *solution #5* for similar problem/solution - http://rodaine.com/2015/04/async-split-io-reader-in-golang/ . A video file is required to be processed in multiple formats where io.MultiWriter is used to send all data asynchronously

[go-nuts] Heap fragmentation: HeapProfile reported memory vs Memstats.HeapInUse

2017-01-31 Thread Sarath Lakshman
I am observing Memstats.HeapInUse of 50GB while a heap profile reports only 24GB. I tried increasing the heapprofile rate to 1KB and still I notice the same behavior. I added an app level accounting of memory usage and that also reports close to 24GB. This makes me think that this could be memory

[go-nuts] Re: Migrating from a classic OO pattern

2017-01-31 Thread Henry
Have you considered the possibility of splitting the prepare-and-attack method into prepare and attack respectively? Even in a OO language, I generally try to avoid a base class being dependent on its subclasses. The subclasses may depend on the base class, but not the other way around. 2-ways

[go-nuts] Re: Migrating from a classic OO pattern

2017-01-31 Thread ojucie
My approach to mimic OOP behavior would be something like this: https://play.golang.org/p/QQvWxfOiMB It's funny how hard was to learn OOP and how easy was to unlearn it. To the present day I never had to do such gymnastic to program using Go. Not even once. -- You received this message because

Re: [go-nuts] Appending a path to an URL

2017-01-31 Thread Andy Balholm
The part being added is treated as an absolute path, because it starts with a slash, so it replaces the existing path. Andy > On Jan 31, 2017, at 2:09 PM, Manlio Perillo wrote: > > Il giorno martedì 31 gennaio 2017 18:35:02 UTC+1, Manlio Perillo ha scritto: > Thanks,

[go-nuts] Re: How can I distribute incoming HTTP request to 5 asynchronous workers?

2017-01-31 Thread Paweł Szczur
I read whole request body. Pack to some structure. Send to a message queue (RabbitMQ, Kafka, Google Pub/Sub). MQ services allow to configure a topic/channel to multiplex a msg to all receivers (in PubSub you would create multiple subscriptions for a given topic

Re: [go-nuts] How can I distribute incoming HTTP request to 5 asynchronous workers?

2017-01-31 Thread Michael Banzon
Read the content - wrap it up and start the five goroutines and pass it to them? On Tue, Jan 31, 2017 at 10:42 PM Onur Özer wrote: > No, results not sent back and yes workers rely on the content. > > On Wed, 1 Feb 2017 at 00:41, Michael Banzon wrote: >

[go-nuts] Re: Appending a path to an URL

2017-01-31 Thread Manlio Perillo
Il giorno martedì 31 gennaio 2017 18:35:02 UTC+1, Manlio Perillo ha scritto: > > Thanks, I was not aware of this behavior. > > The documentation says: > "Parse parses a URL in the context of the receiver. The provided URL may > be relative or absolute." > > Probably an example should be added? >

Re: [go-nuts] How can I distribute incoming HTTP request to 5 asynchronous workers?

2017-01-31 Thread Onur Özer
No, results not sent back and yes workers rely on the content. On Wed, 1 Feb 2017 at 00:41, Michael Banzon wrote: > Does the processing result get returned to the client? > > Does the workers rely on the content of the request body? > > On Tue, Jan 31, 2017 at 10:38 PM oso

Re: [go-nuts] How can I distribute incoming HTTP request to 5 asynchronous workers?

2017-01-31 Thread Michael Banzon
Does the processing result get returned to the client? Does the workers rely on the content of the request body? On Tue, Jan 31, 2017 at 10:38 PM oso wrote: > Hello, I have 5 workers to process asynchronous HTTP requests to the > system. They all process the same HTTP

[go-nuts] How can I distribute incoming HTTP request to 5 asynchronous workers?

2017-01-31 Thread oso
Hello, I have 5 workers to process asynchronous HTTP requests to the system. They all process the same HTTP request in different ways. Workers who finish their job are starting to process the HTTP request. How can I implement this system? Regards, -- You received this message because you are

Re: [go-nuts] Looking for a SQLite statement parser

2017-01-31 Thread Vasiliy Tolstov
cznic/ql have own lexer for SQL and it syntax very similar. 31 Янв 2017 г. 16:33 пользователь написал: > Hello, > > I am the creator of rqlite (https://github.com/rqlite/rqlite), a > distributed relational database built on SQLite. > > I'm looking for a lexer and parser

[go-nuts] Re: Appending a path to an URL

2017-01-31 Thread Manlio Perillo
Thanks, I was not aware of this behavior. The documentation says: "Parse parses a URL in the context of the receiver. The provided URL may be relative or absolute." Probably an example should be added? Manlio Il giorno martedì 31 gennaio 2017 13:07:48 UTC+1, Martin Gallagher ha scritto: > >

[go-nuts] Should an input validation function correct the input?

2017-01-31 Thread JohnGB
In each of the handlers in an API I have, I first unmarshal the JSON request, and then validate the resulting struct. There are a few cases where I am able to pick up a correctable error in the validation code, but I'm not sure whether it's good practice to correct the error in the input

[go-nuts] Question on lib/pq CopyInSchema

2017-01-31 Thread Mandolyte
I have a date column which isn't fully populated. I tried to use "\N" per (1) and also just an empty string. Neither worked, both giving this error: invalid input syntax for type date Is there a way to supply null values for CopyInSchema? -- You received this message because you are

[go-nuts] Re: About "Declaring Empty Slices" of CodeReviewComments

2017-01-31 Thread James Bardin
None of those values are escaping or being used. Your only allocation is probably the call to fmt.Fprint. This isn't something that really needs a benchmark, it should be obvious that t is nil in `var t []string`, and t is not nil in `t := []string{}`. The former doesn't allocate a slice

[go-nuts] Looking for a SQLite statement parser

2017-01-31 Thread philip
Hello, I am the creator of rqlite (https://github.com/rqlite/rqlite), a distributed relational database built on SQLite. I'm looking for a lexer and parser for SQL -- specifically SQLite, to improve the ease-of-use of rqlite. I've thought about looking into using the C code exposed by the

[go-nuts] Appending a path to an URL

2017-01-31 Thread Martin Gallagher
Is this what you want: https://play.golang.org/p/BW96Bk_sqJ -- 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

RE: [go-nuts] Is Go too strict for nesting function callings?

2017-01-31 Thread John Souvestre
Interesting! Thanks. John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of Jonas August Sent: 2017 January 30, Mon 04:25 To: golang-nuts Subject: Re: [go-nuts] Is Go too strict for nesting function callings?