Re: [go-nuts] Interface method return other interface?

2019-10-10 Thread Martin Palma
s one point you need to remember when returning interfaces: > > make sure you handle nil correctly: > > > > type S struct {} > > > > type I interface {} > > > > func f() *S { > > return nil > > } > > > > func g() I { > > x:=f()

[go-nuts] Interface method return other interface?

2019-10-09 Thread Martin Palma
I'm wondering If it is ok (or good Go code) if an interface method returns an other interface? Here an example: type Querier interface { Query() string } type Decoder interface { DecodeAndValidate() Querier } -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] JWT validation only in Middleware

2019-09-27 Thread Martin Palma
wrote: > On Thu, Sep 26, 2019 at 1:14 PM Martin Palma wrote: > > > > Hello, > > > > I'm in the process of writing an HTTP API with Go. I use a middleware > for generating and validating JWT tokens. On any incoming request the > middleware checks the JWT and validates i

[go-nuts] JWT validation only in Middleware

2019-09-26 Thread Martin Palma
Hello, I'm in the process of writing an HTTP API with Go. I use a middleware for generating and validating JWT tokens. On any incoming request the middleware checks the JWT and validates it. If valid it adds it to the request header and calls the next handler. Is it save to use the JWT in