These are chat archives for gin-gonic/gin

11th
Apr 2016
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:49
@otraore so I just looked into fasthttprouter and everything went well until I reached multipartform and binding.
Ousmane Traore
@otraore
Apr 11 2016 00:50
Oh, what are the issues?
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:50
also my code was getting even worse because of casting from []byte to string
@otraore basically the issues are that the algorithms used to interface with the old net/http doesn't seems easy to adapt for fasthttp
Ousmane Traore
@otraore
Apr 11 2016 00:52
@javierprovecho Maybe look into how echo implemented it?
Have an engine interface
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:52
I just leave it for tonight, but I'll keep working at it next week
Ousmane Traore
@otraore
Apr 11 2016 00:52
Alright thank you
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:52
@otraore yes and no, I'll explain
@otraore echo is a cool framework, but it is somehow different from gin. If I implement fasthttp it should be in a newer framework (ginv2)
but I don't have clear what to keep and what to improve yet
As said, I'll keep working at it, now that I'm using gin in a very large project at work.
Simon Green
@CaptainCodeman
Apr 11 2016 00:54
I agree, I don’t think you often want to switch between them - I think you need to code your app with one in mind
Dean Karn
@joeybloggs
Apr 11 2016 00:54
IMHO it's not worth losing WebSockets and HTTP2
Simon Green
@CaptainCodeman
Apr 11 2016 00:55
Maybe have a common core for the routing parts
Similar to echo but abstractions in a different place
don’t try to create interfaces for everything and hide that fasthttp is used
Ousmane Traore
@otraore
Apr 11 2016 00:56
@CaptainCodeman I didn't plan on switching :p I already have a lot of logic already written in go and I don't ever regret using it.
Simon Green
@CaptainCodeman
Apr 11 2016 00:56
I use echo and gin for different things, mostly echo but gin is good too
Ousmane Traore
@otraore
Apr 11 2016 00:56
But my thoughts were if performance improvements were possible, why not
Simon Green
@CaptainCodeman
Apr 11 2016 00:57
yes, but I think to get the real benefit of fasthttp you have to fully embrace it and trying to make it switchable kind of goes against that
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:57
@otraore I see fasthttp + gin in way like "gin lite" but I don't get why make an effort on it having fasthttprouter, which is basically the origins of gin,
Simon Green
@CaptainCodeman
Apr 11 2016 00:58
yeah, I see that just being a bit of overlap
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:58
What Manu and me are talking in person is how can Iris can be so fast
Ousmane Traore
@otraore
Apr 11 2016 00:58
Caching
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:58
And we are looking forward to improve the tree
Ousmane Traore
@otraore
Apr 11 2016 00:58
empty controllers
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:58
Not just caching
Simon Green
@CaptainCodeman
Apr 11 2016 00:58
LOL
caching and copying benchmarks from slower machines?
Ousmane Traore
@otraore
Apr 11 2016 00:59
^
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:59
They use binary tree, and we wonder what can we take for us
Simon Green
@CaptainCodeman
Apr 11 2016 00:59
to be honest, I don’t think absolute speed is the be all and end all
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:59
Of course a cool feature for gin would be caching.
Simon Green
@CaptainCodeman
Apr 11 2016 00:59
it’s also about well designed and reliable code
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 00:59
but another one would be regex
Ousmane Traore
@otraore
Apr 11 2016 00:59
regex support to the router?
like /hello/[regex_here]
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 01:00
@CaptainCodeman that's not a thing to be happy from gin, it is still heavy undocumented
Simon Green
@CaptainCodeman
Apr 11 2016 01:00
please don’t add caching, it isn’t the place to do it, there are much better solutions already available and it’s a huge thing to do right
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 01:00
@otraore yes, many people ask for it
Ousmane Traore
@otraore
Apr 11 2016 01:00
Caching can be done by the user if it needs to be
I don't think gin needs it
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 01:00
@CaptainCodeman don't worry, we are just discussing alternatives to keep the project alive and moving
Simon Green
@CaptainCodeman
Apr 11 2016 01:01
yeah I know, just giving my 2c
Javier Provecho Fernandez
@javierprovecho
Apr 11 2016 01:02
Well guys, it is too late in Spain, I need some sleep 👍🏻😴
Simon Green
@CaptainCodeman
Apr 11 2016 01:02
:thumbsup:
Ousmane Traore
@otraore
Apr 11 2016 01:02
Alright good night @javierprovecho Thank you for your efforts!
Brad Rydzewski
@bradrydzewski
Apr 11 2016 21:58
I wanted to share https://github.com/drone/gin-location ... I've been using this code in a number of projects to automatically determine a server's hostname and scheme
the specific use case is Drone (CI server) needs to know its own URL for oauth redirects, links in emails, etc. We don't want sysadmins to have to remember to explicitly provide this information in configuration files when they setup Drone, so we use this middleware to automatically detect it
Ousmane Traore
@otraore
Apr 11 2016 22:10
This is perfect
@bradrydzewski I can see its use in one of the projects I'm working on. Currently I'm setting this in a configuration file too.
Simon Green
@CaptainCodeman
Apr 11 2016 22:12
remember, the request that hits the server isn’t always the same thing as the user has in their browser (if you have proxies / load balancers etc…)
I can see it being useful though
Ousmane Traore
@otraore
Apr 11 2016 22:13
Proxies and load balancers set headers though
Brad Rydzewski
@bradrydzewski
Apr 11 2016 22:13
@CaptainCodeman we check common headers
Ousmane Traore
@otraore
Apr 11 2016 22:13
"X-Forwarded-For" and "X-Forwarded-Proto" in specific
I didn't know drone uses gin :o . That's pretty cool.
Simon Green
@CaptainCodeman
Apr 11 2016 22:14
cool, I know some of my services are served from a different port than the user uses though (e.g. app engine managed VMs listen on 8080 but the user requests on 80)
Ousmane Traore
@otraore
Apr 11 2016 22:15
Certain headers should be passed to your service though.
Brad Rydzewski
@bradrydzewski
Apr 11 2016 22:16
localhost:8080 is the fallback address, used when it can't figure it out any other way
which you can customize
Simon Green
@CaptainCodeman
Apr 11 2016 22:16
hmmn, I need to check - if it works it would be useful to save some config
Brad Rydzewski
@bradrydzewski
Apr 11 2016 22:16
we have been using it with drone/drone for a few years now, which has thousands of installs on a variety of server configurations, load balancers, etc
that isn't to say it is perfect ... but has worked well for us
but if there are any edge cases we are missing would be happy to accept a PR :)
Simon Green
@CaptainCodeman
Apr 11 2016 22:18
I’ll have a look, app engine is a little strange sometimes
Brad Rydzewski
@bradrydzewski
Apr 11 2016 22:19
thanks, let me know. happy to get feedback and improve
Simon Green
@CaptainCodeman
Apr 11 2016 22:19
will do :thumbsup: