Live data from Hacker News

The best Go framework: no framework?

threedots.tech

11–20 of 185 posts

Re: The best Go framework: no framework?

#11
post #6

Same old topic. I use gin. It's not perfect, especially streaming (EventSource) is broken. But the rest has actual hand on solutions. ctx.SecureJSON() Not a single one of the other packages has something like that. Keyword: JSON hijacking protection. Yes it's still a thing.

Isn't it just prepending "while(1);" to your responses? If that's all you need, it seems like a dependency overkill

Re: The best Go framework: no framework?

#12
Tired: Framework stuff.

Wired: Browser WASM (from Go source) that accepts commands over websockets to modify & render the DOM. (Is this "client hydration"?) Tight integration with htmlx (for pizazz + ruthless efficiency) and Javascript (for rich text editors + other advanced widgetry). This may require full Go, if tinygo continues to lack reflection support.

Re: The best Go framework: no framework?

#13

For junior developers reading this: frameworks are great, learn to love them, they will save you much time and stress when shipping real products.

However maybe also learn to love a language that embraces them at the same time so you don't come away with a poor experience because of only trying a language that has poor frameworks (Go, JS/TS, etc).

Definitely try something like Python + Django, Ruby + Rails, Java/Kotlin + Spring to get a feel for what a mature framework can really do.

Then if you find you still don't like frameworks and the style of programming associated with them then sure, find a home in one of the ecosystems that are more inclined to roll it your own way.

Frameworks certainly aren't for everyone but using bad frameworks and then pretending all frameworks are therefore bad is highly prevalent among more recent developers. Try the good ones and then make up your own mind.

Re: The best Go framework: no framework?

#14
post #8

This is one of the better things about Go and its community: eschewing frameworks like this. Having an ecosystem of in-house libraries tailored to your products' use cases is not the same as developing an "ad-hoc framework". Where I work, we have several languages deployed in our fleet of microservices. A couple have frameworks, and these frameworks are "try to do it all" types, complete with dependency injection and…

I've spent the last year exploring different languages and ecosystems than the one I'm most comfortable in (Python) and what you said absolutely rings true. When you're picking up C#/.NET, there's this almost overwhelming amount of terminology you see getting tossed around that takes you a while to see how it all fits together.

Now that I'm exploring Go, I'm surprised at how many books/learning materials are basically surveys of the features of the language, and then it's basically - "Start building!" "Introducing Go" is just 100 pages for example.

Re: The best Go framework: no framework?

#16

Go having a standard library that is so good for building simple services is what sets it aside from all the other languages that have come out in the last while in the same space. It has a great collection of community libraries but I so rarely need to fall back to them as I can usually cobble together whatever I need to pretty easily just using the standard library. It makes it easy to get started on a project as t…

Agreed. But doesn't it seem sometimes as though some modest improvements here & there in the stdlib would have a big payoff in making it immensely more productive ?

Re: The best Go framework: no framework?

#17
post #6

Same old topic. I use gin. It's not perfect, especially streaming (EventSource) is broken. But the rest has actual hand on solutions. ctx.SecureJSON() Not a single one of the other packages has something like that. Keyword: JSON hijacking protection. Yes it's still a thing.

Isn't it just prepending "while(1);" to your responses? If that's all you need, it seems like a dependency overkill

I think this is the thing with (web) frameworks. Are you really going to remember that? And actually do it? And work around and build those other gnarly things for CSRF, SSRF and XSS? If you only need to serve happy-case HTTP, for sure you're better of without a framework. At least my experience without using a framework is that it's a tad annoying when you need the extras. And requires a lot deeper understanding of things as you don't abstract it away which is good for learning, but might be cumbersome for actually shipping things.

Re: The best Go framework: no framework?

#18
post #8

This is one of the better things about Go and its community: eschewing frameworks like this. Having an ecosystem of in-house libraries tailored to your products' use cases is not the same as developing an "ad-hoc framework". Where I work, we have several languages deployed in our fleet of microservices. A couple have frameworks, and these frameworks are "try to do it all" types, complete with dependency injection and…

the clojure crowd went this way too, libs over framework, as opposed to django and the likes where you can indeed hit sad corner cases.

Re: The best Go framework: no framework?

#19
post #13

For junior developers reading this: frameworks are great, learn to love them, they will save you much time and stress when shipping real products.

However maybe also learn to love a language that embraces them at the same time so you don't come away with a poor experience because of only trying a language that has poor frameworks (Go, JS/TS, etc). Definitely try something like Python + Django, Ruby + Rails, Java/Kotlin + Spring to get a feel for what a mature framework can really do. Then if you find you still don't like frameworks and the style of programming…

Agreed and well put.

Lack of a decent Rails/Django option for JS/TS is part of the issue IMO, since that ecosystem is so popular atm.

I also wonder if you have to get burned a few times rolling your own and that's just part of the journey :)

Re: The best Go framework: no framework?

#20
You also get to implement stuff like CSRF protection, cookie signing, anti session fixation, etc. You also lose out on community contributions because you are your own community now. You also better have stellar internal documentation because onboarding developers is going to be a pain otherwise.

99% of cases people are better off using a boring conventional web framework and implementing their actual business logic on top of it.

Post reply on HN