Live data from Hacker News

Ask HN: Are you using Go for web development?

news.ycombinator.com

41–43 of 43 posts

Re: Ask HN: Are you using Go for web development?

#41
post #36
post #27

Earlier quoted context omitted.

And 1 year later you've finally deployed a registration form. And 6 years laters you've invented an undocumented poor man's version of Flask. And 16 years laters you invented your own ruby on rails, except with no community, no third party libraries, no support and no documentations. At some point you've left the company and some poor soul is dealing with your simplicity.

I was only speaking about one-man personal projects. In my case, I shipped 3 of them (nullitics, lalatabs and a brand new version of onthesamepage) in 3 months. Depends on the project type and on the person, I guess.

First time I came across nullitics and it looks quite nice (GDPR, no cookies and all). Do you do any marketing? Seems you never posted it on HN ..

Also I like your blog. Articles like re-implementing Vue and React and KVM are quite instructive.

Re: Ask HN: Are you using Go for web development?

#42
We keep things as close to the bare metal as possible and avoid complex layers as the plague.

We have only negative experiences with frameworks and big layers. They solve problems quickly in the beginning, but they always end up causing problems. Years later, debugging strange errors, security issues, etc. The more layers you add the less useful and good the application becomes.

we use the standard library and a couple of slim and well written external libraries, such as sqlx and go-sql-driver.

I have written my own HTML form validator and custom error handler - once you get that done, web development in Go becomes MUCH easier.

We don't use ANY JavaScript on the front-end unless it is a minor custom enhancement to the UI (it must be able to run without). Everything is pure HTML and CSS.

However, I personally do find the HTML templating tedious, but I have always found templating stupid and annoying, this is not specific to Go. I prefer to write HTML inline in PHP (when I do PHP) i.e. the old fashion way. I hate templating in any language!

It's easy to make mistakes in Go HTML templates, make sure you test that part of your code well!

Writing big web applications from scratch is great though, and it's really fast in Go, faster than PHP, as long as you do it right! Documentation, documentation, documentation. Anyone who inherits your code, whether you're alone or on a team, needs to know and understand your thinking and rationale.

The main reason why projects fail when they build tailor made software is because of laziness regarding documentation.

The correct way is to regard missing documentation as a bug! Write the documentation WHEN you write the code. If you change the code, change the documentation right away, when you can still remember what you're doing and why - this is the most important part and why so many code bases are horrible to inherit. Missing or poor documentation.

Never use "clever" code, make code that is easy to read and understand. Don't worry too much about design patterns and philosophy, they mostly belong in the books and in theoretical discussions!

Web development in Go is not for everyone, it requires experience and thoroughness. The build fast, deploy and forget strategy - that most people use these days - doesn't belong in Go.

Go will reward you in the end with really good performance and very easy future maintenance. Nothing suddenly breaks because a third of the standard library has suddenly been changed in the next version upgrade, such as with PHP.

EDIT: Typo.

Re: Ask HN: Are you using Go for web development?

#43
Yes, both for personal projects and at work. I write APIs in Go (and there's React on the UI side that talks to it). I use VS Code to develop and build as a Docker image.

At work the images are deployed on DC/OS, and for my personal projects I use Docker Compose.

The most difficult part (which isn't really that difficult) would probably be the actual deployment part, and that's not specific to Go.

Post reply on HN