[go-nuts] Re: best practices of client middleware

2018-03-06 Thread Eyal Posener
offered a PR on alice (which is a middleware library for the handlers) > that does that. It's essentially an application of the same pattern. We're > getting a lot of mileage for this. > > https://github.com/justinas/alice/pull/40 > > On Tuesday, March 6, 2018 at 6:41

[go-nuts] Re: best practices of client middleware

2018-03-06 Thread Eyal Posener
ew middleware is > trivial), but it might introduce dependency that you don't want, so I hope > this will provide inspiration on how you would do something similar > yourself. > > On Monday, March 5, 2018 at 3:03:14 PM UTC+1, Eyal Posener wrote: >> >> Hi >> &

[go-nuts] best practices of client middleware

2018-03-05 Thread Eyal Posener
Hi I want to implement a client middleware - for example: sign the request body and add the signature as an HTTP header. I thought that the best way to do it is to implement a RoundTripper interface which up on request, calculate the signature, ad

[go-nuts] Re: http client for go-server-timing

2018-02-26 Thread Eyal Posener
d by doing something like: > > func NewClient(ctx context.Context, timingOpts []Option, httpOpts []Option > ) *http.Client > > There is a tradeoff in readability though. Maybe using the options pattern > is adding unnecessary complexity here? > > Thanks for the MIT licensing.

[go-nuts] http client for go-server-timing

2018-02-26 Thread Eyal Posener
Hi, Recently mitchellh wrote a really awesome library that provide HTTP middleware for server-timing headers. I saw that and thought it would be really nice to automate those headers for HTTP calls between servers. So I created this library: https

[go-nuts] "Try Go" in golang.org stopped working properly?

2018-01-27 Thread Eyal Posener
When I "Run", can't see the proper output, just "Program exited". Only after changing "Hello World" to another example and then back to "Hello World" I see the right output: Hello, 世界 Program exited. -- You received this message because you are subscribed to the Google Groups "golang-nuts" gr

[go-nuts] Be Careful with Table Driven Tests and t.Parallel()

2018-01-13 Thread Eyal Posener
Hi, A small talk about table driven tests and t.Parallel - it is dangerous! https://gist.github.com/posener/92a55c4cd441fc5e5e85f27bca008721 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving email

[go-nuts] Re: [ANN] A Typed ORM Library

2017-12-23 Thread Eyal Posener
Nice stuff Alexey! thanks for this link, haven't seen it so far. Seems like we both got frustrated from the same issues with existing solutions :-) We took pretty different approaches to solve the typed-ORM problem though. The reform library has a larger run-time content, and keeps the generated

[go-nuts] Re: [ANN] A Typed ORM Library

2017-12-22 Thread Eyal Posener
Hi Tamas, Thanks for the link, haven't seen that tool. Actually, as I understand, it is exactly the opposite, xo generates go code from SQL database. A comparable tool I found is https://github.com/relops/sqlc. On Friday, December 22, 2017 at 10:49:37 PM UTC+2, Tamás Gulácsi wrote: > > Have you s

[go-nuts] [ANN] A Typed ORM Library

2017-12-22 Thread Eyal Posener
Hi In the last month I spent my free time on creating a typed ORM library for Go. The motivation was that the currently most popular ORM library for Go: GORM , lacks type safety, has poor performance and, to my opinion, has unclear API. Don't get me wrong, GORM is gr

[go-nuts] Story: writing scripts in Go

2017-09-08 Thread Eyal Posener
Hi, I wrote a story about my experience in trying to write scripts in Go . Would love your opinion about it! Please comment in the gist itself, and not here. Cheers, Eyal -- You received this message because you are subscribed to

[go-nuts] Function Failure Reporting: Error or OK bool

2017-08-01 Thread Eyal Posener
An article about the different Go conventions of function failure reporting https://gist.github.com/posener/a303becac35835ad7bf5e15fe061893e Enjoy! :-) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rece

[go-nuts] Re: bash completion for flag package

2017-05-23 Thread Eyal Posener
No subcommand options :-) On Wednesday, May 24, 2017 at 3:21:23 AM UTC+3, Will Faught wrote: > > Can it complete subcommands? > > By the way, there's a small syntax error in the readme example: > []string{"work", "dring} > > On Tuesday, May 23, 2017

[go-nuts] bash completion for flag package

2017-05-23 Thread Eyal Posener
I recently did the complete package , that enables bash completion for the go command line. I came to be really satisfied with the result, but the package downside is that the completion can be inconsistent with the actual flags provided by the program. I tho

[go-nuts] Re: New fully featured bash completion for go - written in go

2017-05-15 Thread Eyal Posener
The right installation commands are: go get github.com/posener/complete/gocomplete gocomplete -install You can also view the code in https://github.com/posener/complete On Saturday, May 13, 2017 at 11:29:47 AM UTC+3, Eyal Posener wrote: > > Simple to install (Assuming GOPATH and PA

Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-14 Thread Eyal Posener
Sure, open an issue, I'll fix that On Sunday, May 14, 2017 at 10:30:57 AM UTC+3, Frank Schröder wrote: > > It's not how other completions work, it's redundant and makes it harder to > read. > > Frank Schröder > > > On 14. May 2017, at 09:04, Eyal Pose

Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-14 Thread Eyal Posener
directories are completed with the `./` prefix, Does it make any problems? > > Eg consul agent -server -data-dir ./data > > Frank Schröder > > On 14. May 2017, at 07:46, Eyal Posener > > wrote: > > Frank, sweet! > > Notice that you can build custom comple

Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-13 Thread Eyal Posener
Frank, sweet! Notice that you can build custom completions, such as completing agent names in consul exec -node and service names after -service and so on. Also, you may suggest to add this code to the main consul repo. On Sunday, May 14, 2017 at 3:58:37 AM UTC+3, Frank Schröder wrote: > > Thi

Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-13 Thread Eyal Posener
ich does not need to be changed, and is added when you type `gocomplete -install`. > > It seems useful to have some Go completions (e.g. go in == go > install) available as part of distro packages. > > On Sat, May 13, 2017 at 1:29 AM, Eyal Posener > wrote: > >> Simple t

[go-nuts] New fully featured bash completion for go - written in go

2017-05-13 Thread Eyal Posener
Simple to install (Assuming GOPATH and PATH are correct): go install github.com/posener/complete/gocomplete gocomplete -install Features: - Complete go command, sub commands and flags. - Complete package names, .go files and ellipsis when necessary. - Complete test names after -run fla

Re: [go-nuts] uint type safety in go

2017-03-14 Thread Eyal Posener
Thanks for the answer. Very interesting. About the run time cost, does go always prefer safety over efficiency? or there is some kind of delicate balance between the two? On Tuesday, March 14, 2017 at 4:12:31 PM UTC+2, Ian Lance Taylor wrote: > > On Tue, Mar 14, 2017 at 6:48 AM, Eyal P

[go-nuts] uint type safety in go

2017-03-14 Thread Eyal Posener
I was thinking about the type safety of uint in go, and comparing it for a similar problem. If I have this go code: var x uint x-- The value of x is then the maximal value of uint, which is probably not what the gother wanted (I think, is there any particular use cases for that that you know