3 ms·
I would say in this case it's more the API designers' fault than Go's fault. Looks like the Python API is operating at a higher abstraction level than the Go AP
by rob74 4y ago
I would say in this case it's more the API designers' fault than Go's fault. Looks like the Python API is operating at a higher abstraction level than the Go API - using the Python API you can just call a "macro" that does everything required, in Go you have to call each operation individually.
- AtNightWeCode 4y ago
- dang 4y agoCan you please avoid flamebait comments and make your substantive points thoughtfully, per https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html? We don't want flamewars here. Programming language flamewars are especially tedious.
- AtNightWeCode 4y agoNot sure what you are talking about. When I learned C back in the 90’s I was learned to handle every error state by hand. Exactly as you are expected to do in Go about 30 years later. And it sucks. Maybe you can explain why Gophers are such whiners always crying about every freaking comment at any forum.
- dang 4y agoCan you please just not post like this? We're trying for a different kind of forum. I know it feels justified, and I'm sure it is, but the problem is the 'other' side always has its legitimate justifications too, and then everyone goes after each other and there's no more curious exchange.
- AtNightWeCode 4y ago
- youor 4y ago
- throwaway894345 4y agoIt probably is Go's propensity to return error values whereas Python would bubble them up. Every action in Docker involves an I/O error at a minimum (since you're talking to the Docker daemon) so this is basically a worst-case scenario for error handling boilerplate. I don't doubt that Python is better for scripting in this case, but if you want to make an application that interfaces with Docker, Go is probably the better of the two (despite its boilerplate). In fact, I vaguely recall running into a bunch of Python-related bugs in docker-compose (it was at an old gig, and I haven't used docker-compose since, so I don't recall the particulars).
- rob74 4y agoStill, creating a method that calls several other methods one after another is programming 101, so I refuse to entertain the though that creating a "containers.run" method similar to the one from the Python API is not possible in Go. The error handling is definitely not the culprit, you can check the error after each "subcommand" and return early with this error. The question is just, why didn't they do it?
- throwaway894345 4y agoFair enough. I didn't look deeply at the API differences.