Remix.run Logo
guappa a day ago

From go programs at the very least I can expect they won't respect normal GNU getopt command line options, and work terribly with signals and going background in the terminal and so on.

If it's a server, of course it won't support any way of communicating it's ready. Not the old fork way and certainly not the new sdnotify things.

Daegalus a day ago | parent [-]

why would it have to respect GNU getopt? When did that become the golden standard? I never respect getopt because I really don't care about it and it has no bearing on anything I build. As long as they are documented under `--help`. Almost everyone uses Cobra from command-line options. And it is capable of doing getopt if you want, but I don't see why it would be a requirement.

Signals and Backgrounding seem to be just developers that have little experience with that stuff. I can't remember the last time I did any sort of signal handling to do anything specific. And I haven't had issues with backgrounding, but that might be just the tools I use and the infrequency of backgrounding that I do.

Most servers I interact with or work on have some sort of `health` api endpoint to get that status because most servers in go are HTTP. What more are you expecting? I don't even know what you are referring to by the `old fork way` but I will agree most don't use sdnotify, as that makes the assumption you are running Go on something that handles systemd notifications.

I am fairly certain a majority of Go servers run in a container, specifically an Alpine, distroless, or scratch container. So communication would be over stdout or some kind of API endpoint, be it HTTP, GRPC, or any other TCP/UDP endpoint.

guappa 10 hours ago | parent [-]

> When did that become the golden standard?

30 years ago?

> Signals and Backgrounding seem to be just developers that have little experience with that stuff.

Yes, go developers have little experience. I see we agree.

> What more are you expecting?

Them to tell systemd they started.

> I don't even know what you are referring to by the `old fork way`

As I said, most go developers have little experience. I see you agree once again.

The old fork way is the portable way to do it with whatever init system (systemd included).

Daegalus 9 hours ago | parent [-]

> 30 years ago?

I have yet to find a developer, go or otherwise, that cares strongly enough about getopt outside the hardcore FOSS groups that pays attention to this. I know of getopt, and I don't follow it, because no one ever told me to was the golden standard, I was under the impression it was one of many ways, not the only way, especially if you work with systems like Windows at any point, that doesn't follow it either. I also personally don't like the getopt style

> Yes, go developers have little experience. I see we agree.

Or you know, they have no need for it, and don't implement it. You are conflating inexperience, with not caring about the thing you care about.

> Them to tell systemd they started.

Why? Very few services care about your init system these days. Like I said, containers have made it so you don't need to worry about it. I have dealt with many supervisors and init systems, and I have 0 interest in specifically adding code to notify them. At best I will add a network endpoint, and it is up to the unit file to poll for it, if it can.

> As I said, most go developers have little experience. I see you agree once again.

No, I am arguing that in modern day server dev, it is an unnecessary skill to learn, so they don't either learn it, while having plenty of other experience, or they specifically don't care enough about it for it to matter to them.

> The old fork way is the portable way to do it with whatever init system (systemd included).

This assumes you care about an init system at all. Like I mentioned previously, the majority of places Go servers run on are either in Containers, or microvms. The init system does not matter. So few go devs take the time to implement support. It is not lack of experience, it is priorities.

I work in DevOps, ever since we moved primarily to containers, I have stopped caring about adding signal handlers, init system supports, etc. I write far fewer init files, be it unit files for systemd, or old school SysV stuff. It is an unnecessary set of features to add for projects that are internal, small, or run in containers. I am sure if a Go project gets big enough, it gets support for init systems, but those kind of projects are few, and init system support is an after-thought.

If you are so big on FOSS standards, maybe open a PR and add the necessary sd_notify features. Should be only a few lines of code if you import https://github.com/coreos/go-systemd/blob/main/daemon/sdnoti... and call it.

Most Go projects won't add this by default, because the use-case is infrequent for it for most places Go is used. Just like the article said a pro and con of the Go ecosystem is we don't need to worry about the rest of the dev world to gain the benefits of Go. So GNU/linux standards are not a priority. Especially with how easy it is to build cross-platform, using a Linux standard for all platforms is not perfect.

Maybe take the time to be open minded instead of calling the entire Go dev ecosystem "inexperienced", it is simply the case of priorities and needs to the community, and when there is no need for doing the things you mention, they aren't added, even if the devs know about them.

And I disagree that everyone should follow getopt, it is not the only way, and it is not necessarily the best way.

guappa 8 hours ago | parent [-]

> I have yet to find a developer […]

Users care, because that's how all the other commands work. It's the standard whether you like it or not. Of course you can choose to do the snowflake CLI, but that doesn't really shout "experienced dev" does it?

> windows

oh lol… what % of go programs is used on windows? 1? 2?

> Why?

So systemd can start the other service that depends on that one?

You need to know when the docker daemon is up and running before starting your containers no?

You don't know how to do a thing that anyone writing a server process should know.

Yes you're further and further proving my point that go developers are on average less experienced. And you seem ok with that except when it's pointed out.

> maybe open a PR

I have far more FOSS contributions than you do. Mostly in C/C++ or Python.

> Maybe take the time to be open minded instead of calling the entire Go dev ecosystem "inexperienced"

Maybe take the criticism instead of getting angry.

Daegalus 7 hours ago | parent [-]

> Users care, because that's how all the other commands work. It's the standard whether you like it or not. Of course you can choose to do the snowflake CLI, but that doesn't really shout "experienced dev" does it?

I have never had a user complain about this. They just read the readme or the `help` and use it accordingly.

> oh lol… what % of go programs is used on windows? 1? 2?

I am sure it is quite a bit more than that, especially since I tend to see `exe` builds for most go tools I have used.

> You don't know how to do a thing that anyone writing a server process should know.

Oh I know it, I just don't think it is relevant for my day to day, or most of the go-made servers or tools I run.

Another thing that you seem to be assuming is that I am waiting for daemons to start. I used the term Containers instead of Docker specifically because the majority of them are in Kubernetes, or get converted to VMs for services like Fly.io. In those situations the daemon, or equivalent, is already running. I also use Podman, which doesn't have a daemon unless you need one.

And in the few cases where I would have needed to wait, I poll the docker unix socket for the /info path, and get the information that way.

> I have far more FOSS contributions than you do. Mostly in C/C++ or Python.

I never argued that, I have a paltry amount of FOSS contributions compared to most people interested in open source. I just said that if it matters so much to you that you are willing to label an entire dev community as inexperienced, and act all high and mighty about some standards that aren't seen as important these days, then you should teach us how to be better. Open that PR and show us the way. Obviously there is only 1 way to do things, and you are already well versed in it, guide us out of the dark hole we apparently live in.

> Maybe take the criticism instead of getting angry.

I am not in the least bit angry. I am discussing this, because I believe you are stuck in old ways and not adapting to the changes in the industry and development, especially in the areas where Go is used most, which is servers, devops, containers, and the like.

Also, I acknowledge there are industries, environments, etc that can't or won't use containers. But that is a small percentage of use-cases, and the engineers there are probably building things properly.

I will also never say no to implementing such a thing if I get an issue opened requesting it, a PR opened to add it for me, or the like. But I have not seen a need for it in years, both professionally or personally, to be added right away. And I feel like majority of Go devs have nothing against it, and would add it if requested. I know Miniflux for example, after their V2 rewrite into Go, added it 8 months later, due to a request. and have been maintaining/improving it since.

I had no clue how the sd_notify support was in Go in general, until this conversation with you. Not because I wasn't aware of sd_notify, I just never had to go looking for it or needed it. Took me 10 seconds to google it, find a library that saves me time, and I can add it to any server I need it in now. But I will do that if needed, not pre-emptively. Especially since 95% of the servers I make are for work, and dont need systemd. And personal stuff doesn't need it either. But if I opensource anything, and it is requested? I will add it without much fanfare.