Re: [go-nuts] How do you feel about using variadic functions for optional dependency injection in Go?

2020-02-14 Thread Ben Burwell
This reminds me of the "functional options" approach: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis Of course, the difference being Dave is talking about configuring a struct type and you're talking about configuring a func type. -- You received this message because you

Re: [go-nuts] HTTP:ListenAndServe questions

2019-09-23 Thread Ben Burwell
On Mon Sep 23, 2019 at 5:50 PM joe mcguckin wrote: > In ListenAndServe, I see that it calls (*Server).Serve(ln), then 'go > c.serve(ctx)' > I can't find a function named 'serve'. Where is this? On line 1760 of the same file, server.go. > Does HTTP manage a pool of coroutines or does it create o

Re: [go-nuts] Use of NoMethod type for custom marshaling

2019-09-14 Thread Ben Burwell
On Sat Sep 14, 2019 at 1:43 AM Sathish VJ wrote: > I saw some code where there is a temporary type called *noMethod* created > before performing custom marshaling. > > What is the purpose of doing this? > > type T struct { > A int > C string > } > > func (t T) MarshalJSON() (text []byte, err

Re: [go-nuts] GCP will lowercase header names from September 30. – I would like to update my code to only send lowercase headers

2019-08-27 Thread Ben Burwell
> What do you guys do? Do you think it's necessary to update the headers > sent as long as the clients are case insensitive? Per RFC 2068 section 4.2, HTTP/1.1 headers are case insensitive. So unless your HTTP clients don't conform to RFC 2068, I wouldn't worry about it. Even then, you should pro

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] Proposal: test in one package can import functions from another package's test

2019-04-09 Thread Ben Burwell
On Mon, Apr 08, 2019 at 08:33:44PM -0700, nanmu42 wrote: > I don't know you, but to me, writing Golang test is a little dreary. > > As a discussion, I think this proposal could bring some improvement. > > How do you like it? > > https://github.com/golang/go/issues/31135 In your (admittedly cont