top | item 37965217

Go Package for Building Progressive Web Apps

130 points| greenSunglass | 2 years ago |go-app.dev | reply

58 comments

order
[+] Sheeny96|2 years ago|reply
https://github.com/a-h/templ

Templ is a far more elegant solution for composing HTML within Go

[+] adonese|2 years ago|reply
Pro hype here, BUT add htmx to it and it's a match made in heaven. Rationale: templ is a template engine with the same syntax as go (so no need to learn or be worried about any new syntax). Htmx makes html more powerful
[+] jeroenhd|2 years ago|reply
I don't see how it compares. Go-app does page rendering in the frontend, in this website's case based on Markdown files. It does have some backend generation capabilities (for SEO, apparently) but that's not its main feature.

I suppose you could probably port templ to a frontend framework through WASM, but I don't know why you would go through the effort when go-app is already there.

[+] austinpena|2 years ago|reply
Has anyone got this working with IntelliJ?
[+] udkl|2 years ago|reply
Looks like what PHP does !
[+] latchkey|2 years ago|reply
Sigh. What is old is new again. It was a terrible idea back then too...

https://jakarta.apache.org/ecs/

[+] voidfunc|2 years ago|reply
The same developers that were raised and soaked in Java enterprise development are now Go developers. Expect more of this especially as Go enters the Enterprise sphere.
[+] s17n|2 years ago|reply
It's how react works, though, and react is absolutely dominant... do you think that's despite the "terrible idea"?
[+] throwaway892238|2 years ago|reply
Everybody wants to make an app.

But nobody wants to make An App.

[+] benatkin|2 years ago|reply
This shouldn’t be news. There is JSX which is like this but with a special syntax, and there’s Swift and Flutter which look similar.
[+] dewey|2 years ago|reply
I can't come up with a single reason that makes this better, easier, shorter than just using a html + Go templating.
[+] janderland|2 years ago|reply
There is obviously an improvement in type safety. This would transform silent HTML typos into Go compile errors. Though I could understand some thinking this is not worth the extra syntax.
[+] rubicon33|2 years ago|reply
Am I the only one who feels like declarative programming fucking sucks?
[+] diggan|2 years ago|reply
Am I the only one who uses declarative programming when it makes sense, and $other-type-of-programming when that make sense?

When creating UIs, I haven't found anything better than declarative programming. But in the end, it's all trade-offs, nothing seems to be a silver bullet, UI programming just fucking sucks in general.

[+] Exoristos|2 years ago|reply
Declarative programming is the best programming.
[+] l5870uoo9y|2 years ago|reply
Once you are used to the patterns and functions coding becomes faster, easier to understand and less error prone.
[+] didip|2 years ago|reply
I prefer writing a normal server-side with Go template and use HTMX on the client side.
[+] awill88|2 years ago|reply
Hold up, they lost me at “declarative syntax” no, it’s Golang. It’s not infrastructure as code. Hard pass, use templates..
[+] jtokoph|2 years ago|reply
It’s odd to me that children are added via a Body method. I would assume it would be a Children method; plus body is its own HTML tag.
[+] ekiauhce|2 years ago|reply
Is this some kind of joke?

I waited about half a minute for percent counter reach 100%, then it just keep loading with the counter beyond one hundred lol

So “progressive”

[+] jbotdev|2 years ago|reply
I think you’re confusing Progressive Web App (PWA) with Progressive Enhancement. PWA is basically a web app (typically an SPA) that behaves like a native app, as described in the MDN page they reference. Loading progressively such that the page is still useful without JS is Progressive Enhancement.
[+] Exoristos|2 years ago|reply
To be fair, Progressive Web App is a pretty stupid nomenclature.
[+] omani|2 years ago|reply
Look at the comments here. Are you guys stupid bots? It's about WEBASSEMBLY. Not an html template system.
[+] jeroenhd|2 years ago|reply
It looks like an HTML templating engine. I guess it packages the HTML rendering itself into client side WASM, but I'm not sure if that's an improvement.

I'm not sure what the WASM part does from the website to be honest, at first I thought the server generates the HTML but it seems everything is rendered client side? The architecture page (https://go-app.dev/architecture#app-wasm) describes the basic working of a WASM application, but that's it. There's also pre-rendering (https://go-app.dev/seo) for SEO reasons, so in a sense the project is ALSO a server-side HTML templating system.

[+] cdelsolar|2 years ago|reply
That’s kinda mean
[+] omani|2 years ago|reply
I have used this and I like it.
[+] bborud|2 years ago|reply
Why?

Has anyone ever worked on a product where this would be even remotely feasible?

[+] FireInsight|2 years ago|reply
I find that most these sorts of projects are for people just toying around or who have an irrational hatred of the JS ecosystem... Ultimately they lock devs into a tight, less supported ecosystem, and they might end up writing some parts in the languages native to the web anyways. And I mean, the page doesn't even load for me on my browser, just stuck at 0%. What kind of documentation page even needs a progressbar, just use a static page, right?

Edit: for what it's worth, I gave this a second chance with raw Chromium. Loaded up to 400%, heh, but tbf the page does have product examples for seemingly useful products.

[+] hningonworktime|2 years ago|reply
...So that you can make PWAs using Go?

There are multiple "Built with" examples on the page - but why does everything have to be a product at the end of the day?

[+] reactordev|2 years ago|reply
As someone who has contributed to Electron alternatives, I welcome it. Electron.js is so large, binary size wise, that we should be picking the right web-app stack for the job. Webview for example, to allow one to write web-apps in C++ with bindings for other languages.

Personally, go’s ability to serve content from its own binary using the `embed` package is one of the most killer features. I can ship a single binary and have my entire client packed inside. All at 28mb.

[+] candiodari|2 years ago|reply
I shipped a huge product with GWT. Backend and frontend in Java. It's still running (unlike many Java GUIs I made). I don't see why this wouldn't work.